PageSourceSearch

https://bacctrack-7ha7hyw7.manus.space/assets/ForgotPasswordPage-DTqGzDBp.js

js bacctrack-7ha7hyw7.manus.space collected 2026-10-03 05:00:22 UTC 16,360 bytes, 1 lines download raw bytes

1import{u as y,c as O,r as g,j as e,d as S,b as r,t as C}from"./index-C3Qps0S4.js";import{A as L}from"./arrow-left-AxGNO8ZF.js";import{K as E}from"./key-round-wjdacBW6.js";import{P as w}from"./phone-C7ssNq9Y.js";import{L as $}from"./lock-BImxJe9g.js";import{E as q}from"./external-link-BaKbLCyP.js";import{H as A}from"./headphones-D6SC7HuD.js";import{S as R}from"./send-CbRcUDpe.js";import{M as I}from"./message-circle-BkrB8C2p.js";function U(){const[,l]=y(),{lang:t}=O(),[c,x]=g.useState("request"),[o,s]=g.useState(""),[n,P]=g.useState(""),[j,v]=g.useState(""),[m,N]=g.useState(""),[u,F]=g.useState(""),[d,h]=g.useState(!1),f=async a=>{if(a.preventDefault(),!o.trim()){r.error(t==="th"?"กรุณากรอกเบอร์โทรศัพท์หรืออีเมล":"Please enter phone number or email");return}h(!0);try{const i=await fetch("/api/auth/forgot-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identifier:o.trim()})}),p=await i.json();if(!i.ok){r.error(p.error||"เกิดข้อผิดพลาด");return}r.success(t==="th"?"ส่งรหัส OTP เรียบร้อย":"OTP sent successfully"),x("verify")}catch{r.error(t==="th"?"เกิดข้อผิดพลาด กรุณาลองใหม่":"An error occurred")}finally{h(!1)}},T=async a=>{if(a.preventDefault(),!n.trim()){r.error(t==="th"?"กรุณากรอกรหัส OTP":"Please enter OTP");return}h(!0);try{const i=await fetch("/api/auth/verify-otp",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({identifier:o.trim(),otp:n.trim()})}),p=await i.json();if(!i.ok){r.error(p.error||"รหัส OTP ไม่ถูกต้อง");return}v(p.resetToken),r.success(t==="th"?"ยืนยัน OTP สำเร็จ":"OTP verified"),x("reset")}catch{r.error(t==="th"?"เกิดข้อผิดพลาด กรุณาลองใหม่":"An error occurred")}finally{h(!1)}},k=async a=>{if(a.preventDefault(),!m||!u){r.error(t==="th"?"กรุณากรอกรหัสผ่านใหม่":"Please enter new password");return}if(m.length<6){r.error(t==="th"?"รหัสผ่านต้องมีอย่างน้อย 6 ตัวอักษร":"Password must be at least 6 characters");return}if(m!==u){r.error(t==="th"?"รหัสผ่านไม่ตรงกัน":"Passwords don't match");return}h(!0);try{const i=await fetch("/api/auth/reset-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({resetToken:j,newPassword:m,confirmPassword:u})}),p=await i.json();if(!i.ok){r.error(p.error||"เกิดข้อผิดพลาด");return}r.success(t==="th"?"เปลี่ยนรหัสผ่านสำเร็จ!":"Password changed successfully!"),setTimeout(()=>l("/login"),1500)}catch{r.error(t==="th"?"เกิดข้อผิดพลาด กรุณาลองใหม่":"An error occurred")}finally{h(!1)}};return e.jsx("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:115",className:"min-h-screen bg-[#0a0e1a] flex items-center justify-center p-4",children:e.jsxs("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:116",className:"w-full max-w-sm",children:[e.jsxs("button",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:118",onClick:()=>c==="request"?l("/login"):x(c==="verify"?"request":"verify"),className:"flex items-center gap-2 text-gray-400 hover:text-white transition-colors mb-6",children:[e.jsx(L,{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:122",className:"w-4 h-4"}),e.jsx("span",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:123",className:"text-sm",children:t==="th"?"ย้อนกลับ":"Back"})]}),e.jsxs("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:127",className:"bg-white/5 backdrop-blur-xl border border-white/10 rounded-2xl p-6",children:[e.jsx("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:129",className:"flex items-center justify-center gap-2 mb-6",children:[1,2,3].map(a=>e.jsx("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:131",className:`w-8 h-1 rounded-full transition-all ${a<=(c==="request"?1:c==="verify"?2:3)?"bg-orange-500":"bg-white/10"}`},a))}),c==="request"&&e.jsxs("form",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:144",onSubmit:f,className:"space-y-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:145",className:"text-center mb-4",children:[e.jsx("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:146",className:"w-14 h-14 roun
1ded-2xl bg-orange-500/10 flex items-center justify-center mx-auto mb-3",children:e.jsx(E,{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:147",className:"w-7 h-7 text-orange-400"})}),e.jsx("h1",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:149",className:"text-lg font-bold text-white",children:t==="th"?"ลืมรหัสผ่าน":"Forgot Password"}),e.jsx("p",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:152",className:"text-xs text-gray-400 mt-1",children:t==="th"?"กรอกเบอร์โทรศัพท์หรืออีเมลที่ใช้สมัคร":"Enter your registered phone or email"})]}),e.jsxs("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:159",children:[e.jsx("label",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:160",className:"text-xs font-medium text-gray-300 mb-1.5 block",children:t==="th"?"เบอร์โทรศัพท์ หรือ อีเมล":"Phone or Email"}),e.jsxs("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:163",className:"relative",children:[e.jsx("input",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:164",type:"text",value:o,onChange:a=>s(a.target.value),className:"w-full bg-black/40 border border-white/10 rounded-xl px-4 py-3 pl-10 text-sm text-white placeholder:text-gray-600 focus:border-orange-500/50 focus:ring-1 focus:ring-orange-500/20 focus:outline-none transition-all",placeholder:t==="th"?"0812345678 หรือ [email protected]":"0812345678 or [email protected]"}),e.jsx(w,{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:171",className:"w-4 h-4 text-gray-500 absolute left-3 top-1/2 -translate-y-1/2"})]})]}),e.jsx("button",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:175",type:"submit",disabled:d,className:"w-full py-3.5 rounded-xl bg-gradient-to-r from-orange-500 via-red-500 to-pink-500 text-white font-bold text-sm disabled:opacity-50 transition-all duration-200 active:scale-[0.97] shadow-lg shadow-orange-500/25",children:d?t==="th"?"กำลังส่ง...":"Sending...":t==="th"?"ส่งรหัส OTP":"Send OTP"})]}),c==="verify"&&e.jsxs("form",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:189",onSubmit:T,className:"space-y-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:190",className:"text-center mb-4",children:[e.jsx("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:191",className:"w-14 h-14 rounded-2xl bg-blue-500/10 flex items-center justify-center mx-auto mb-3",children:e.jsx(S,{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:192",className:"w-7 h-7 text-blue-400"})}),e.jsx("h1",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:194",className:"text-lg font-bold text-white",children:t==="th"?"ยืนยันรหัส OTP":"Verify OTP"}),e.jsx("p",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:197",className:"text-xs text-gray-400 mt-1",children:t==="th"?"กรอกรหัส 6 หลักที่ได้รับ":"Enter the 6-digit code you received"}),e.jsx("p",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:202",className:"text-xs text-orange-400/80 mt-2",children:t==="th"?`ส่งไปที่: ${o.substring(0,3)}***${o.substring(o.length-2)}`:`Sent to: ${o.substring(0,3)}***${o.substring(o.length-2)}`})]}),e.jsxs("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:209",children:[e.jsx("label",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:210",className:"text-xs font-medium text-gray-300 mb-1.5 block",children:t==="th"?"รหัส OTP (6 หลัก)":"OTP Code (6 digits)"}),e.jsx("input",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:213",type:"text",value:n,onChange:a=>P(a.target.value.replace(/\D/g,"").slice(0,6)),className:"w-full bg-black/40 border border-white/10 rounded-xl px-4 py-3 text-sm text-white text-center tracking-[0.5em] font-mono placeholder:text-gray-600 focus:border-orange-500/50 focus:ring-1 focus:ring-orange-500/20 focus:outline-none transition-all",placeholder:"000000",maxLength:6,autoFocus:!0})]}),e.jsx("button",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:224",type:"submit",disabled:d||n.length!==6,className:"w-full py-3.5 rounded-xl bg-gradient-to-r from-blue-500 to-purple-500 text-white font-bold text-sm disabled:opacity-50 transition-all duration-200 active:scale-[0.97] shadow-lg shadow-blue-500/25",children:d?t==="th"?"กำลังตรวจสอบ...":"
1Verifying...":t==="th"?"ยืนยัน OTP":"Verify OTP"}),e.jsx("button",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:234",type:"button",onClick:f,disabled:d,className:"w-full text-xs text-gray-400 hover:text-orange-400 transition-colors py-2",children:t==="th"?"ส่งรหัส OTP อีกครั้ง":"Resend OTP"})]}),c==="reset"&&e.jsxs("form",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:247",onSubmit:k,className:"space-y-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:248",className:"text-center mb-4",children:[e.jsx("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:249",className:"w-14 h-14 rounded-2xl bg-green-500/10 flex items-center justify-center mx-auto mb-3",children:e.jsx($,{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:250",className:"w-7 h-7 text-green-400"})}),e.jsx("h1",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:252",className:"text-lg font-bold text-white",children:t==="th"?"ตั้งรหัสผ่านใหม่":"Set New Password"}),e.jsx("p",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:255",className:"text-xs text-gray-400 mt-1",children:t==="th"?"กรอกรหัสผ่านใหม่ที่ต้องการ (อย่างน้อย 6 ตัวอักษร)":"Enter your new password (min 6 characters)"})]}),e.jsxs("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:262",children:[e.jsx("label",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:263",className:"text-xs font-medium text-gray-300 mb-1.5 block",children:t==="th"?"รหัสผ่านใหม่":"New Password"}),e.jsx("input",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:266",type:"password",value:m,onChange:a=>N(a.target.value),className:"w-full bg-black/40 border border-white/10 rounded-xl px-4 py-3 text-sm text-white placeholder:text-gray-600 focus:border-orange-500/50 focus:ring-1 focus:ring-orange-500/20 focus:outline-none transition-all",placeholder:t==="th"?"รหัสผ่านใหม่ (อย่างน้อย 6 ตัว)":"New password (min 6 chars)"})]}),e.jsxs("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:275",children:[e.jsx("label",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:276",className:"text-xs font-medium text-gray-300 mb-1.5 block",children:t==="th"?"ยืนยันรหัสผ่านใหม่":"Confirm New Password"}),e.jsx("input",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:279",type:"password",value:u,onChange:a=>F(a.target.value),className:"w-full bg-black/40 border border-white/10 rounded-xl px-4 py-3 text-sm text-white placeholder:text-gray-600 focus:border-orange-500/50 focus:ring-1 focus:ring-orange-500/20 focus:outline-none transition-all",placeholder:t==="th"?"กรอกรหัสผ่านอีกครั้ง":"Confirm password"})]}),e.jsx("button",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:288",type:"submit",disabled:d,className:"w-full py-3.5 rounded-xl bg-gradient-to-r from-green-500 to-emerald-500 text-white font-bold text-sm disabled:opacity-50 transition-all duration-200 active:scale-[0.97] shadow-lg shadow-green-500/25",children:d?t==="th"?"กำลังเปลี่ยน...":"Changing...":t==="th"?"เปลี่ยนรหัสผ่าน":"Change Password"})]})]}),e.jsx(V,{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:302",lang:t})]})})}const D={line:e.jsx(I,{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:310",className:"w-5 h-5"}),telegram:e.jsx(R,{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:311",className:"w-5 h-5"}),livechat:e.jsx(A,{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:312",className:"w-5 h-5"}),phone:e.jsx(w,{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:313",className:"w-5 h-5"})},b={line:{bg:"bg-green-500/10",border:"border-green-500/30 hover:border-green-500/60",text:"text-green-400"},telegram:{bg:"bg-sky-400/10",border:"border-sky-400/30 hover:border-sky-400/60",text:"text-sky-400"},livechat:{bg:"bg-orange-500/10",border:"border-orange-500/30 hover:border-orange-500/60",text:"text-orange-400"},phone:{bg:"bg-emerald-500/10",border:"border-emerald-500/30 hover:border-emerald-500/60",text:"text-emerald-400"}};function V({lang:l}){const[,t]=y(),{data:c}=C.contact.list.useQuery(),x=c?.filter(s=>["line","telegram","livechat","phone"].includes(s.channelType))||[];if(x.length===0)return null;const o=s=>{s.channelType==="livechat"?t("/live-chat"):s.channelType==="phone"&&s.value?window.open(`tel:${s.value}`,"_blank"):s.url&&window.open(s.url,"_blank")};return e.jsxs("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:345",className:"mt-5",children:[e.jsxs("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:347",className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:348",className:"flex-1 h-px bg-white/10"}),e.jsx("span",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:349",className:"text-[11px] text-gray-500 whitespace-nowrap",children:l==="th"?"หรือ ติดต่อแอดมินเพื่อขอเปลี่ยนรหัสผ่าน":"Or contact admin to reset password"}),e.jsx("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:352",className:"flex-1 h-px bg-white/10"})]}),e.jsx("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:356",className:"space-y-2.5",children:x.map(s=>{const n=b[s.channelType]||b.phone,P=D[s.channelType]||e.jsx(w,{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:359",className:"w-5 h-5"});return e.jsxs("button",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:361",onClick:()=>o(s),className:`w-full flex items-center gap-3 px-4 py-3 rounded-xl border ${n.border} ${n.bg} transition-all duration-200 active:scale-[0.97] group`,children:[e.jsx("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:366",className:`${n.text}`,children:P}),e.jsxs("div",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:369",className:"flex-1 text-left",children:[e.jsx("p",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:370",className:"text-sm font-medium text-white",children:s.label||s.channelType}),e.jsx("p",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:373",className:"text-[11px] text-gray-500",children:s.channelType==="livechat"?l==="th"?"แชทสดกับแอดมินโดยตรง":"Chat directly with admin":s.channelType==="line"?l==="th"?"แจ้งแอดมินผ่าน LINE":"Contact admin via LINE":s.channelType==="telegram"?l==="th"?"แจ้งแอดมินผ่าน Telegram":"Contact admin via Telegram":s.value||""})]}),e.jsx(q,{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:383",className:"w-4 h-4 text-gray-600 group-hover:text-gray-400 transition-colors"})]},s.channelType)})}),e.jsx("p",{"data-loc":"client/src/pages/ForgotPasswordPage.tsx:390",className:"text-[10px] text-gray-600 text-center mt-3",children:l==="th"?"แจ้ง username หรือเบอร์โทรที่สมัคร เพื่อยืนยันตัวตนกับแอดมิน":"Provide your username or registered phone to verify your identity"})]})}
1export{U as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.