1import{u as N,r as a,s as n,j as s,L as v,B as m,t as o}from"./index-P6gp-aZt.js";import{I as u}from"./input-DjMejl9x.js";import{L as x}from"./label-B0ZEWUZ2.js";import{s as y}from"./extension-auth-B_JeSTLN.js";import{P as h,i as P}from"./password-policy-B8LisPqf.js";function R(){N();const[p,w]=a.useState(!0),[f,g]=a.useState(!1),[r,j]=a.useState(""),[i,b]=a.useState(""),[d,l]=a.useState(!1);a.useEffect(()=>{let e=!1;return n.auth.getSession().then(({data:t})=>{e||(g(!!t.session),w(!1))}),()=>{e=!0}},[]);const S=async e=>{if(e.preventDefault(),!P(r)){o.error(h);return}if(r!==i){o.error("Passwords don't match.");return}l(!0);try{const{error:t}=await n.auth.updateUser({password:r});if(t)throw t;o.success("Password updated.");const{data:c}=await n.auth.getSession();c.session&&y(c.session),window.location.assign("/dashboard")}catch(t){o.error(t instanceof Error?t.message:"Couldn't update your password. Please try again."),l(!1)}};return s.jsx("div",{className:"min-h-screen bg-slate-50 text-slate-900 flex items-center justify-center px-6",children:s.jsx("div",{className:"w-full max-w-md",children:s.jsx("div",{className:"bg-white border border-slate-200 rounded-xl p-8 shadow-xl shadow-slate-900/5",children:p?s.jsx("div",{className:"py-12 text-center text-sm text-slate-500",children:"Loadingâ¦"}):f?s.jsxs(s.Fragment,{children:[s.jsx("h1",{className:"text-2xl font-bold mb-1 text-slate-900",children:"Set a password"}),s.jsx("p",{className:"text-sm text-slate-500 mb-6",children:"Choose a password for your account. You will use it with a code sent to your email each time you sign in."}),s.jsxs("form",{onSubmit:S,className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx(x,{htmlFor:"new-password",children:"New password"}),s.jsx(u,{id:"new-password",type:"password",value:r,onChange:e=>j(e.target.value),autoComplete:"new-password",required:!0}),s.jsx("p",{className:"text-xs text-slate-500 mt-1",children:h})]}),s.jsxs("div",{children:[s.jsx(x,{htmlFor:"confirm-password",children:"Confirm new password"}),s.jsx(u,{id:"confirm-password",type:"password",value:i,onChange:e=>b(e.target.value),autoComplete:"new-password",required:!0})]}),s.jsx(m,{type:"submit",className:"w-full",disabled:d,children:d?"Updatingâ¦":"Update password"})]})]}):s.jsxs("div",{className:"text-center",children:[s.jsx("h1",{className:"text-2xl font-bold mb-3 text-slate-900",children:"Link expired"}),s.jsx("p",{className:"text-sm text-slate-600 leading-relaxed mb-6",children:"This password reset link is invalid or has expired. Request a new one from the sign-in page."}),s.jsx(v,{to:"/login",search:{mode:"signin"},children:s.jsx(m,{className:"w-full",children:"Back to sign in"})})]})})})})}export{R as component};
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.