Files
adnexus/assets/PasswordReset-D1ACWMAm.js
2026-09-20 08:53:09 -07:00

2 lines
2.4 KiB
JavaScript

import{r as i,j as e}from"./ui-SA1K2VdO.js";import{s as h}from"./client-Cs5qpnPJ.js";import{u as p,C as f,a as j,b,c as g,d as w,B as o}from"./index-BBRaFEzF.js";import{I as y}from"./input-jTrHrzjY.js";import{b as N,L as v}from"./vendor-khT4bKqW.js";import{y as k,h as C}from"./utils-BOogt4zp.js";const P=()=>{const d=N(),{toast:n}=p(),[t,c]=i.useState(""),[a,l]=i.useState(!1),[m,u]=i.useState(!1),x=async r=>{r.preventDefault(),l(!0);try{const{error:s}=await h.auth.resetPasswordForEmail(t,{redirectTo:`${window.location.origin}/auth?reset=true`});if(s)throw s;u(!0),n({title:"Reset email sent!",description:"Check your email for the password reset link."})}catch(s){n({title:"Reset Failed",description:s instanceof Error?s.message:"Failed to send reset email.",variant:"destructive"})}finally{l(!1)}};return e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-6",children:e.jsxs("div",{className:"w-full max-w-md",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsxs(v,{to:"/auth",className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground mb-6",children:[e.jsx(k,{size:16}),"Back to login"]}),e.jsxs("div",{className:"text-3xl font-bold mb-2",children:["Ad",e.jsx("span",{className:"text-gradient",children:"nexus"})]}),e.jsx("p",{className:"text-muted-foreground",children:"Reset your password"})]}),e.jsxs(f,{className:"gradient-card backdrop-blur-sm border-primary/20",children:[e.jsxs(j,{className:"text-center pb-2",children:[e.jsx(b,{children:"Password Reset"}),e.jsx(g,{children:"Enter your email and we'll send you a reset link"})]}),e.jsx(w,{children:m?e.jsxs("div",{className:"text-center space-y-4",children:[e.jsx("div",{className:"w-16 h-16 bg-primary/10 rounded-full flex items-center justify-center mx-auto",children:e.jsx(C,{className:"w-8 h-8 text-primary"})}),e.jsx("h3",{className:"font-semibold",children:"Check your email"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["We've sent a password reset link to ",t]}),e.jsx(o,{variant:"outline",className:"w-full",onClick:()=>d("/auth"),children:"Back to Login"})]}):e.jsxs("form",{onSubmit:x,className:"space-y-4",children:[e.jsx("div",{children:e.jsx(y,{type:"email",placeholder:"Email",value:t,onChange:r=>c(r.target.value),required:!0,disabled:a})}),e.jsx(o,{type:"submit",className:"w-full",disabled:a,children:a?"Sending...":"Send Reset Link"})]})})]})]})})};export{P as default};