PageSourceSearch

https://royaldoors.co.uk/assets/ForgotPassword-CdVZNs4f.js

js royaldoors.co.uk collected 2026-10-04 08:44:12 UTC 3,370 bytes, 1 lines download raw bytes

1import{r,j as e}from"./ui-vendor-DuqeynD1.js";import{B as i,L as m}from"./index-D6hryE5F.js";import{P as h}from"./PublicLayout-Ce_YdSmf.js";import{I as C}from"./input-CnAoxUlZ.js";import{C as x,b as u,c as f,d as p,a as j}from"./card-G9Q-B1n4.js";import{L as v}from"./label-CPdpbaDO.js";import{A as g}from"./AuthBackground-G5zLQg55.js";import{j as S,f as w,L}from"./icons-DC9PkIwp.js";import"./react-vendor-Bzgz95E1.js";import"./query-vendor-DND6ZGMt.js";import"./siteNavigation-DFnjV5BW.js";import"./dropdown-menu-CmP7s5y8.js";import"./GoogleIcon-A6ncl4ml.js";function J(){const[l,y]=r.useState(""),[n,d]=r.useState(!1),[N,c]=r.useState(!1),[s,a]=r.useState(""),b=async o=>{o.preventDefault(),d(!0),a("");try{const t=await fetch("/api/auth/forgot-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:l}),credentials:"include"}),k=await t.json();t.ok?c(!0):t.status===429?a("Too many attempts. Please try again later."):a(k.error||"Something went wrong")}catch{a("Failed to send reset email")}finally{d(!1)}};return N?e.jsx(h,{children:e.jsx(g,{children:e.jsxs(x,{className:"w-full max-w-md 
1shadow-2xl",children:[e.jsxs(u,{className:"text-center",children:[e.jsx("div",{className:"mx-auto w-12 h-12 bg-green-100 rounded-full flex items-center justify-center mb-4",children:e.jsx(S,{className:"h-6 w-6 text-green-600"})}),e.jsx(f,{children:"Check Your Email"}),e.jsxs(p,{children:["If an account exists with ",e.jsx("strong",{children:l}),", you will receive a password reset link shortly."]})]}),e.jsxs(j,{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-gray-500 text-center",children:"The link will expire in 1 hour. If you don't see the email, check your spam folder."}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(i,{variant:"outline",onClick:()=>c(!1),"data-testid":"button-try-another-email",children:"Try another email"}),e.jsx(m,{href:"/login",children:e.jsxs(i,{variant:"ghost",className:"w-full","data-testid":"link-back-to-login",children:[e.jsx(w,{className:"mr-2 h-4 w-4"}),"Back to login"]})})]})]})]})})}):e.jsx(h,{children:e.jsx(g,{children:e.jsxs(x,{className:"w-full max-w-md 
1shadow-2xl",children:[e.jsxs(u,{className:"text-center space-y-2",children:[e.jsx(f,{children:"Forgot Your Password?"}),e.jsx(p,{children:"Enter your email address and we'll send you a link to reset your password."})]}),e.jsx(j,{children:e.jsxs("form",{onSubmit:b,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{htmlFor:"email",children:"Email Address"}),e.jsx(C,{id:"email",type:"email",autoComplete:"email","aria-invalid":s?!0:void 0,"aria-describedby":s?"forgot-email-error":void 0,placeholder:"[email protected]",value:l,onChange:o=>y(o.target.value),required:!0,"data-testid":"input-forgot-email"})]}),s&&e.jsx("p",{id:"forgot-email-error",role:"alert",className:"text-sm text-red-600","data-testid":"text-error",children:s}),e.jsx(i,{type:"submit",className:"w-full",disabled:n,"data-testid":"button-send-reset-link",children:n?e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"mr-2 h-4 w-4 animate-spin"}),"Sending..."]}):"Send Reset Link"}),e.jsx(m,{href:"/login",children:e.jsxs(i,{variant:"ghost",className:"w-full","data-testid":"link-back-to-login",children:[e.jsx(w,{className:"mr-2 h-4 w-4"}),"Back to login"]})})]})})]})})})}export{J 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.