1import{j as e}from"./vendor-ui-core-DWyIHxpY.js";import{r as d,u}from"./vendor-react-DzMUrXFC.js";import{b as g,z as x}from"./vendor-forms-BIjZt7Hz.js";import{C as y,a as j,b as f,I as b,h as N,N as v,O as w,Q as k,R as S,U as C,V as F,_ as E,X as P,B as t,s as R,J as h,Y as I}from"./main-Z1rTqt3M.js";import"./vendor-supabase-B3U3ReBo.js";import"./vendor-query-9q-iqsHw.js";import"./vendor-charts-CBBN6_gB.js";import"./vendor-ui-extra-C3HD5Ard.js";import"./vendor-motion-YGI21uN_.js";const T=x.object({email:x.string().email({message:"Please enter a valid email address."})});function z(){const[l,o]=d.useState(!1),[n,c]=d.useState(!1),m=u(),s=g({resolver:I(T),defaultValues:{email:""}});async function p(r){o(!0);try{console.log("ð§ Sending password reset request via custom edge function"),console.log(" Email:",r.email),console.log(" Timestamp:",new Date().toISOString());const{data:a,error:i}=await R.functions.invoke("send-password-reset",{body:{email:r.email}});if(i)throw console.error("â Password reset error:",i),new Error(i.message||"Failed to send reset email");console.log("â
Password reset request processed:",a),c(!0),h.success("Password reset email sent! Please check your inbox.")}catch(a){console.error("ð¥ Error sending reset email:",a),h.error(a.message||"Failed to send reset email. Please try again.")}finally{o(!1)}}return e.jsx("div",{className:"container flex items-center justify-center min-h-[calc(100vh-156px)] py-12",children:e.jsxs(y,{className:"w-full max-w-md",children:[e.jsxs(j,{className:"space-y-1 text-center",children:[e.jsx(f,{className:"text-3xl font-bold tracking-tight text-primary-light",children:"Reset Password"}),e.jsx(b,{className:"text-gray-400",children:n?"Check your email for a password reset link":"Enter your email to receive a password reset link"})]}),e.jsx(N,{children:n?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"p-4 bg-green-900/20 border border-green-700 rounded-lg",children:[e.jsx("p",{className:"text-center text-green-300 mb-2",children:"â
Reset email sent successfully!"}),e.jsxs("p",{className:"text-center text-gray-300 text-sm",children:["We've sent an email to"," ",e.jsx("span",{className:"text-primary font-medium",children:s.getValues().email})," ","with instructions to reset your password."]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-center text-gray-400 text-sm",children:"Check your inbox and click the reset link. The email might take a few minutes to arrive."}),e.jsx("p",{className:"text-center text-gray-400 text-xs",children:"Don't forget to check your spam folder if you don't see it."})]}),e.jsxs("div",{className:"p-3 bg-gray-900/30 rounded-lg",children:[e.jsx("p",{className:"text-gray-400 text-xs text-center mb-2",children:e.jsx("strong",{children:"ð¡ Tips:"})}),e.jsxs("ul",{className:"text-gray-500 text-xs space-y-1",children:[e.jsx("li",{children:"⢠Check your email inbox and spam folder"}),e.jsx("li",{children:"⢠The reset link is valid for 1 hour"}),e.jsx("li",{children:"⢠You can open the link in any browser or device"})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(t,{className:"w-full bg-primary hover:bg-primary-dark",onClick:()=>m("/login"),children:"Return to Login"}),e.jsx(t,{variant:"outline",className:"w-full border-primary/20 text-primary hover:bg-primary/10",onClick:()=>{c(!1),s.reset()},children:"Send Another Email"})]})]}):e.jsx(v,{...s,children:e.jsxs("form",{onSubmit:s.handleSubmit(p),className:"space-y-6",children:[e.jsx(w,{control:s.control,name:"email",render:({field:r})=>e.jsxs(k,{children:[e.jsx(S,{className:"text-gray-300",children:"Email"}),e.jsx(C,{children:e.jsxs("div",{className:"relative",children:[e.jsx(F,{placeholder:"Enter your email",type:"email",...r,className:"bg-black/50 border-white/10 pl-10"}),e.jsx(E,{className:"absolute left-3 top-2.5 h-5 w-5 text-gray-400"})]})}),e.jsx(P,{})]})}),e.jsx(t,{type:"submit",className:"w-full bg-primary hover:bg-primary-dark",disabled:l,children:l?"Sending...":"Send Reset Link"}),e.jsxs("div",{className:"text-center text-sm",children:[e.jsxs("span",{className:"text-gray-400",children:["Remember your password?"," "]}),e.jsx(t,{variant:"link",className:"p-0 text-primary-light hover:text-foreground",onClick:()=>
1m("/login"),children:"Back to login"})]})]})})})]})})}export{z as default}; 2//# sourceMappingURL=ForgotPassword-C-cj9uYL.js.map
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.