PageSourceSearch

https://ddok.it/assets/reset-password-NrHUCBic.js

js ddok.it collected 2026-10-06 14:03:32 UTC 5,310 bytes, 1 lines download raw bytes

1import{c7 as T,cO as F,ce as q,c8 as r,cF as E,bh as I,c9 as e,ca as i,cs as M,ck as o,cn as d,cb as m,cl as R,cm as O,cx as V,cM as w,cy as g}from"./index-B9fS4Gmf.js";import{u as B}from"./useMutation-C_rfsYCG.js";import{F as n}from"./footer-DsCuYE5s.js";import{q as D}from"./queryKeys-CUiEbhif.js";import{C as K}from"./circle-x-CL4-DUTq.js";import{C as U}from"./circle-check-big-CmS1prDt.js";import{L as N}from"./lock-BfNOeBUa.js";function G(){const[,x]=T(),u=F(),{toast:l}=q(),[t,b]=r.useState(""),[h,v]=r.useState(""),[f,y]=r.useState(!1),a=r.useMemo(()=>new URLSearchParams(u).get("token")||"",[u]),{data:C,isLoading:k}=E({queryKey:D.auth.resetToken(a),queryFn:async()=>(await fetch(`/api/auth/verify-reset-token?token=${encodeURIComponent(a)}`)).json(),enabled:!!a,staleTime:1/0,gcTime:300*1e3}),S=C?.valid??!1,p=B({mutationFn:async({token:s,password:L})=>{const c=await fetch("/api/auth/reset-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:s,password:L})});if(!c.ok)throw new Error(await I(c,"비밀번호 변경에 실패했습니다."));return c.json()},onSuccess:()=>{y(!0)},onError:s=>{l({title:"오류",description:s.message,variant:"destructive"})}}),P=s=>{if(s.preventDefault(),t.length<6){l({title:"오류",description:"비밀번호는 6자 이상이어야 합니다.",variant:"destructive"});return}if(t!==h){l({title:"오류",description:"비밀번호가 일치하지 않습니다.",variant:"destructive"});return}p.mutate({token:a,password:t})},j=p.isPending;return k?e.jsxs("div",{className:"min-h-screen flex flex-col bg-gradient-to-b from-slate-50 via-white to-emerald-50/30",children:[e.jsx(i,{}),e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx(M,{className:"w-12 h-12 animate-spin text-blue-500 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-600",children:"토큰 확인 중..."})]})}),e.jsx(n,{})]}):!S&&!f?e.jsxs("div",{className:"min-h-screen flex flex-col bg-gradient-to-b from-slate-50 via-white to-emerald-50/30",children:[e.jsx(i,{}),e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx(o,{className:"w-full max-w-md",children:e.jsxs(d,{className:"pt-6 text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-red-100 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(K,{className:"w-8 h-8 text-red-600"})}),e.jsx("h3",{className:"text-lg font-semibold text-gray-800 mb-2",children:"유효하지 않은 링크"}),e.jsxs("p",{className:"text-sm text-gray-600 mb-6",children:["비밀번호 재설정 링크가 만료되었거나 이미 사용되었습니다.",e.jsx("br",{}),"다시 비밀번호 찾기를 요청해주세요."]}),e.jsx(m,{onClick:()=>x("/login"),className:"w-full","data-testid":"button-go-login",children:"로그인 페이지로 이동"})]})})}),e.jsx(n,{})]}):f?e.jsxs("div",{className:"min-h-screen flex flex-col bg-gradient-to-b from-slate-50 via-white to-emerald-50/30",children:[e.jsx(i,{}),e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsx(o,{className:"w-full max-w-md",children:e.jsxs(d,{className:"pt-6 text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(U,{className:"w-8 h-8 text-green-600"})}),e.jsx("h3",{className:"text-lg font-semibold text-gray-800 mb-2",children:"비밀번호가 변경되었습니다"}),e.jsx("p",{className:"text-sm text-gray-600 mb-6",children:"새로운 비밀번호로 로그인해주세요."}),e.jsx(m,{onClick:()=>x("/login"),className:"w-full","data-testid":"button-go-login-success",children:"로그인하기"})]})})}),e.jsx(n,{})]}):e.jsxs("div",{className:"min-h-screen flex flex-col bg-gradient-to-b from-slate-50 via-white to-emerald-50/30",children:[e.jsx(i,{}),e.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:e.jsxs(o,{className:"w-full max-w-md",children:[e.jsxs(R,{className:"text-center",children:[e.jsx(O,{className:"text-2xl",children:"새 비밀번호 설정"}),e.jsx(V,{children:"새로운 비밀번호를 입력해주세요."})]}),e.jsx(d,{children:e.jsxs("form",{onSubmit:P,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{htmlFor:"password",children:"새 비밀번호"}),e.jsxs("div",{className:"relative",children:[e.jsx(N,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),e.jsx(g,{id:"password",type:"password",placeholder:"6자 이상 입력",value:t,onChange:s=>b(s.target.value),className:"pl-10","data-testid":"input-new-password",required:!0})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{htmlFor:"confirmPassword",children:"비밀번호 확인"}),e.jsxs("div",{className:"relative",children:[e.jsx(N,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),e.jsx(g,{id:"confirmPassword",type:"password",placeholder:"비밀번호 다시 입력",value:h,onChange:s=>v(s.target.value),className:"pl-10","data-testid":"input-confirm-password",required:!0})]})]}),e.jsx(m,{type:"submit",className:"w-full",disabled:j,"data-testid":"button-reset-password",children:j?"변경 중...":"비밀번호 변경"})]})})]})}),e.jsx(n,{})]})}
1export{G 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.