1import{d as w,a as j,r as t,b as n,j as e,c as u,I as m,B as N,t as o}from"./index-xiHmsbwW.js";import{C as v}from"./card-D-F8_TGl.js";import{L as y}from"./loader-circle-DY3bQWkx.js";const b=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],C=w("key-round",b);function R(){const p=j(),[x,i]=t.useState(!1),[r,h]=t.useState(""),[c,f]=t.useState(""),[d,l]=t.useState(!1);t.useEffect(()=>{const{data:s}=n.auth.onAuthStateChange(a=>{(a==="PASSWORD_RECOVERY"||a==="SIGNED_IN")&&i(!0)});return n.auth.getSession().then(({data:a})=>{a.session&&i(!0)}),()=>s.subscription.unsubscribe()},[]);const g=async s=>{if(s.preventDefault(),r.length<6){o.error("Password must be at least 6 characters");return}if(r!==c){o.error("Passwords do not match");return}l(!0);const{error:a}=await n.auth.updateUser({password:r});if(l(!1),a){o.error(a.message);return}o.success("Password updated. Please sign in."),await n.auth.signOut(),p({to:"/admin/login",search:{error:""},replace:!0})};return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-surface/30 px-4",children:e.jsxs(v,{className:"w-full max-w-md p-8",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[e.jsx("div",{className:"size-11 rounded-xl bg-primary/10 text-primary flex items-center justify-center",children:e.jsx(C,{className:"size-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-muted-foreground",children:"DoctorPile"}),e.jsx("h1",{className:"text-xl font-bold",children:"Set a new password"})]})]}),x?e.jsxs("form",{onSubmit:g,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(u,{children:"New password"}),e.jsx(m,{type:"password",required:!0,value:r,onChange:s=>h(s.target.value),className:"mt-1.5",autoComplete:"new-password"})]}),e.jsxs("div",{children:[e.jsx(u,{children:"Confirm password"}),e.jsx(m,{type:"password",required:!0,value:c,onChange:s=>f(s.target.value),className:"mt-1.5",autoComplete:"new-password"})]}),e.jsxs(N,{type:"submit",size:"lg",className:"w-full",disabled:d,children:[d&&e.jsx(y,{className:"size-4 animate-spin"})," Update password"]})]}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Waiting for a valid reset link. Please open the link from your email on this device."})]})})}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.