1import{r as n,j as e,a6 as o,_ as j,B as y,L as g,s as N,t as c}from"./index-CQqyzfcg.js";import{I as b}from"./input-6jX-GZnK.js";import{C as m,c as d,a as v,b as w,d as C}from"./card-haCOmQRs.js";import{C as k}from"./circle-check-big-iASHPN42.js";import{B as R}from"./book-open-DXIHvBzg.js";function D(){const[t,u]=n.useState(""),[l,r]=n.useState(!1),[x,h]=n.useState(!1),p=async i=>{if(i.preventDefault(),!!t.trim()){r(!0);try{const{data:s,error:a}=await N.functions.invoke("reset-password-request",{body:{email:t.trim().toLowerCase()}});if(a||s!=null&&s.code){const f=(s==null?void 0:s.code)==="BLOCKED_USER"?"This account has been blocked. Please contact support.":(s==null?void 0:s.code)==="NOT_FOUND"?"No account found with that email address.":(s==null?void 0:s.message)||(a==null?void 0:a.message)||"Please try again.";c({title:"Unable to reset password",description:f,variant:"destructive"}),r(!1);return}h(!0)}catch{c({title:"Error",description:"Could not send recovery email.",variant:"destructive"})}r(!1)}};return x?e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background px-4",children:e.jsx(m,{className:"w-full max-w-md text-center",children:e.jsxs(d,{className:"pt-8 pb-8 space-y-4",children:[e.jsx(k,{className:"h-16 w-16 text-primary mx-auto"}),e.jsx("h3",{className:"text-xl font-semibold",children:"Check your email"}),e.jsx("p",{className:"text-muted-foreground",children:"If an account exists with that email, you'll receive a password reset link shortly."}),e.jsx(o,{to:"/login",className:"text-sm font-medium text-primary underline-offset-4 hover:underline",children:"Back to login"})]})})}):e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background px-4",children:e.jsxs(m,{className:"w-full max-w-md",children:[e.jsxs(v,{className:"text-center",children:[e.jsx("div",{className:"mx-auto mb-2 flex h-12 w-12 items-center justify-center rounded-full bg-primary/10",children:e.jsx(R,{className:"h-6 w-6 text-primary"})}),e.jsx(w,{className:"text-2xl font-bold tracking-tight",children:"Password Recovery"}),e.jsx(C,{children:"Enter your email to receive a password reset link."})]}),e.jsxs(d,{children:[e.jsxs("form",{onSubmit:p,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"email",children:"Email"}),e.jsx(b,{id:"email",type:"email",placeholder:"[email protected]",value:t,onChange:i=>u(i.target.value),required:!0})]}),e.jsxs(y,{type:"submit",className:"w-full gap-2",disabled:l||!t.trim(),children:[l&&e.jsx(g,{className:"h-4 w-4 animate-spin"}),"Reset password"]})]}),e.jsxs("p",{className:"mt-4 text-center text-sm text-muted-foreground",children:["Remember your password?"," ",e.jsx(o,{to:"/login",className:"font-medium text-primary underline-offset-4 hover:underline",children:"Sign in"})]})]})]})})}export{D 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.