1import{u as F,s as S,r as a,j as s,L as d,B as i,w as k}from"./index-CNhMyDWD.js";import{u as R,t as E,c as L}from"./schema-BUkjFQEq.js";import{u as T}from"./useMutation-mQsb0odq.js";import{I as m}from"./input-BzJEtYoZ.js";import{C as u,b as x,c as p,d as w,a as h}from"./card-B_MsSWBb.js";import{F as I,a as f,b as j,c as g,d as y,e as b}from"./form-CaZgSivO.js";import"./index-D4r1jjLZ.js";import"./utils-km2FGkQ4.js";import"./label-BcKfvffh.js";function U(){const[,c]=F(),{toast:t}=S(),[n,C]=a.useState(""),[N,P]=a.useState(!1);a.useEffect(()=>{const l=new URLSearchParams(window.location.search).get("token");l?C(l):(t({title:"Invalid reset link",description:"This reset link is invalid or has expired.",variant:"destructive"}),c("/admin"))},[c,t]);const r=R({resolver:E(L),defaultValues:{token:"",newPassword:"",confirmPassword:""}});a.useEffect(()=>{n&&r.setValue("token",n)},[n,r]);const o=T({mutationFn:async e=>await k("POST","/api/auth/password-reset-confirm",e),onSuccess:()=>{P(!0),t({title:"Password reset successful",description:"Your password has been reset. You can now log in with your new password."})},onError:e=>{t({title:"Reset failed",description:e.message||"Failed to reset password",variant:"destructive"})}}),v=e=>{o.mutate(e)};return N?s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 py-12 px-4 sm:px-6 lg:px-8",children:s.jsxs(u,{className:"w-full max-w-md",children:[s.jsxs(x,{className:"text-center",children:[s.jsx(p,{children:"Password reset successful"}),s.jsx(w,{children:"Your password has been successfully reset. You can now log in with your new password."})]}),s.jsx(h,{children:s.jsx(d,{href:"/admin",children:s.jsx(i,{className:"w-full",children:"Go to Login"})})})]})}):s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 py-12 px-4 sm:px-6 lg:px-8",children:s.jsxs(u,{className:"w-full max-w-md",children:[s.jsxs(x,{className:"text-center",children:[s.jsx(p,{children:"Create new password"}),s.jsx(w,{children:"Enter your new password below. Make sure it's strong and secure."})]}),s.jsx(h,{children:s.jsx(I,{...r,children:s.jsxs("form",{onSubmit:r.handleSubmit(v),className:"space-y-4",children:[s.jsx(f,{control:r.control,name:"newPassword",render:({field:e})=>s.jsxs(j,{children:[s.jsx(g,{children:"New password"}),s.jsx(y,{children:s.jsx(m,{type:"password",placeholder:"Enter new password",...e})}),s.jsx(b,{}),s.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Must be at least 12 characters with uppercase, lowercase, number, and special character"})]})}),s.jsx(f,{control:r.control,name:"confirmPassword",render:({field:e})=>s.jsxs(j,{children:[s.jsx(g,{children:"Confirm new password"}),s.jsx(y,{children:s.jsx(m,{type:"password",placeholder:"Confirm new password",...e})}),s.jsx(b,{})]})}),s.jsx(i,{type:"submit",className:"w-full",disabled:o.isPending,children:o.isPending?"Resetting...":"Reset password"}),s.jsx("div",{className:"text-center",children:s.jsx(d,{href:"/admin",children:s.jsx(i,{variant:"ghost",className:"text-sm",children:"Return to login"})})})]})})})]})})}export{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.