1import{u as g,r as a,s as n,j as s,L as w,t as o}from"./index-B8x47Np6.js";import{B as N}from"./button-D0tjTrtO.js";import{I as l}from"./input-DuQhOHcx.js";import{L as m}from"./label-MxSpsLwE.js";import"./index-C_Ozil7u.js";import"./index-B8k91cqS.js";import"./clsx-B-dksMZM.js";import"./utils-0exNfmSl.js";function k(){const p=g(),[h,i]=a.useState(!1),[r,x]=a.useState(""),[d,f]=a.useState(""),[c,u]=a.useState(!1);a.useEffect(()=>{const{data:e}=n.auth.onAuthStateChange(t=>{(t==="PASSWORD_RECOVERY"||t==="SIGNED_IN")&&i(!0)});return n.auth.getSession().then(({data:t})=>{t.session&&i(!0)}),()=>e.subscription.unsubscribe()},[]);const b=async e=>{if(e.preventDefault(),r.length<8)return o.error("Password must be at least 8 characters.");if(r!==d)return o.error("Passwords don't match.");u(!0);const{error:t}=await n.auth.updateUser({password:r});if(u(!1),t)return o.error(t.message);o.success("Password updated. You're signed in."),p({to:"/moments"})};return s.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center px-4 py-12",children:s.jsxs("div",{className:"w-full max-w-md",children:[s.jsx(w,{to:"/",className:"block text-center mb-8",children:s.jsx("div",{className:"font-display text-3xl",children:"Senior Moments"})}),s.jsxs("div",{className:"rounded-2xl border border-border bg-card p-8 shadow-sm",children:[s.jsx("h1",{className:"font-display text-2xl",children:"Set a new password"}),h?s.jsxs("form",{onSubmit:b,className:"mt-5 space-y-5",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(m,{htmlFor:"pw",className:"text-base",children:"New password"}),s.jsx(l,{id:"pw",type:"password",required:!0,value:r,onChange:e=>x(e.target.value),className:"h-12 text-base"})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(m,{htmlFor:"pw2",className:"text-base",children:"Confirm password"}),s.jsx(l,{id:"pw2",type:"password",required:!0,value:d,onChange:e=>f(e.target.value),className:"h-12 text-base"})]}),s.jsx(N,{type:"submit",disabled:c,className:"h-12 w-full text-base bg-sage text-sage-foreground hover:bg-sage hover:text-sage-foreground hover:brightness-95",children:c?"Updatingâ¦":"Update password"})]}):s.jsx("p",{className:"mt-4 text-muted-foreground",children:"Open this page from the link in your password reset email."})]})]})})}export{k 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.