1import{c as f,r as a,s as r,j as s,t as u}from"./index-DTEDcl9R.js";import{L as x}from"./loader-circle-7g8dRLIH.js";import"./createLucideIcon-DsPU5l8i.js";function w(){const l=f(),[c,n]=a.useState(!1),[o,m]=a.useState(""),[i,d]=a.useState(!1);a.useEffect(()=>{r.auth.getSession().then(({data:e})=>{e.session&&n(!0)});const{data:t}=r.auth.onAuthStateChange(e=>{(e==="PASSWORD_RECOVERY"||e==="SIGNED_IN")&&n(!0)});return()=>t.subscription.unsubscribe()},[]);const p=async t=>{t.preventDefault(),d(!0);try{const{error:e}=await r.auth.updateUser({password:o});if(e)throw e;u.success("Password updated."),l({to:"/admin"})}catch(e){u.error(e instanceof Error?e.message:"Could not update password")}finally{d(!1)}};return s.jsx("div",{className:"min-h-screen bg-cream flex items-center justify-center p-6",children:s.jsxs("div",{className:"w-full max-w-md rounded-3xl bg-white border border-border shadow-soft p-8",children:[s.jsx("h1",{className:"font-display text-2xl font-bold",children:"Set a new password"}),c?s.jsxs("form",{onSubmit:p,className:"mt-5 grid gap-3",children:[s.jsxs("div",{children:[s.jsx("label",{className:"text-sm font-medium",children:"New password"}),s.jsx("input",{type:"password",required:!0,minLength:8,value:o,onChange:t=>m(t.target.value),className:"mt-1.5 w-full rounded-xl border border-input bg-white px-4 py-3 text-sm focus:outline-none focus:ring-2 focus:ring-ring"})]}),s.jsx("button",{disabled:i,type:"submit",className:"inline-flex items-center justify-center gap-2 rounded-full bg-sage text-primary-foreground px-6 py-3 font-semibold disabled:opacity-70",children:i?s.jsx(x,{className:"h-4 w-4 animate-spin"}):"Update password"})]}):s.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:"Open this page from the password reset link in your email."})]})})}export{w 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.