PageSourceSearch

https://nashobahub-prod.onrender.com/assets/ForgotPasswordPage-Dmxyt7PX.js

js nashobahub-prod.onrender.com collected 2026-10-03 11:43:52 UTC 3,736 bytes, 1 lines download raw bytes

1import{av as w,bs as N,u as k,r as d,j as e,C as m,a1 as u,a2 as x,a3 as h,a4 as p,B as i,aw as C,am as S,I as v}from"./index-CU4TP-S4.js";import{u as F,F as E,a as L,b as P,c as T,d as R,f as B,t as I}from"./form-D-xzwno4.js";import{C as A}from"./circle-check-big-Tm_bNKhb.js";import{o as W,s as D}from"./types-BmAflJw1.js";const M=W({email:D().email("Invalid email address")});function H(){const[,n]=w(),s=new URLSearchParams(N()).get("role")||"customer",{toast:o}=k(),[l,c]=d.useState(!1),[f,j]=d.useState(!1),a=F({resolver:I(M),defaultValues:{email:""}}),b=()=>{switch(s){case"admin":return"Admin";case"sales-rep":return"Sales Representative";default:return"Customer"}},g=async r=>{c(!0);try{const t=await fetch("/api/b2b/forgot-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:r.email,userType:s==="sales-rep"?"sales_rep":s})}),y=await t.json();if(!t.ok)throw new Error(y.error||"Failed to send reset email");j(!0),o({title:"Reset Email Sent",description:"Check your email for password reset instructions"})}catch(t){o({title:"Error",description:t.message,variant:"destructive"})}finally{c(!1)}};return f?e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-background to-muted flex items-center justify-center py-12",children:e.jsx("div",{className:"w-full max-w-md px-4",children:e.jsxs(m,{children:[e.jsxs(u,{className:"text-center",children:[e.jsx(A,{className:"h-16 w-16 mx-auto mb-4 text-green-500"}),e.jsx(x,{className:"font-serif text-2xl",children:"Check Your Email"}),e.jsx(h,{children:"We've sent password reset instructions to your email address"})]}),e.jsxs(p,{className:"space-y-4",children:[e.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 text-sm space-y-2",children:[e.jsx("p",{className:"font-medium",children:"What to do next:"}),e.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground",children:[e.jsx("li",{children:"Check your email inbox"}),e.jsx("li",{children:"Look for an email from Nashoba Valley Winery"}),e.jsx("li",{children:"Click the password reset link in the email"}),e.jsx("li",{children:"The link will expire in 1 hour"})]})]}),e.jsx("div",{className:"text-sm text-center text-muted-foreground",children:"Didn't receive the email? Check your spam folder"}),e.jsx(i,{variant:"outline",className:"w-full",onClick:()=>n(`/b2b/login/${s}`),"data-testid":"button-back-to-login",children:"Back to Login"})]})]})})}):e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-background to-muted flex items-center justify-center py-12",children:e.jsxs("div",{className:"w-full max-w-md px-4",children:[e.jsxs(i,{variant:"ghost",onClick:()=>n(`/b2b/login/${s}`),className:"mb-4","data-testid":"button-back",children:[e.jsx(C,{className:"h-4 w-4 mr-2"}),"Back to Login"]}),e.jsxs(m,{children:[e.jsxs(u,{className:"text-center",children:[e.jsx(S,{className:"h-12 w-12 mx-auto mb-4 text-primary"}),e.jsx(x,{className:"font-serif text-2xl",children:"Reset Your Password"}),e.jsxs(h,{children:[b()," Password Reset"]})]}),e.jsx(p,{children:e.jsx(E,{...a,children:e.jsxs("form",{onSubmit:a.handleSubmit(g),className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Enter your email address and we'll send you a link to reset your password."}),e.jsx(L,{control:a.control,name:"email",render:({field:r})=>e.jsxs(P,{children:[e.jsx(T,{children:"Email Address"}),e.jsx(R,{children:e.jsx(v,{...r,type:"email",placeholder:"[email protected]","data-testid":"input-email",autoComplete:"email"})}),e.jsx(B,{})]})}),e.jsx(i,{type:"submit",className:"w-full",size:"lg",disabled:l,"data-testid":"button-send-reset-link",children:l?"Sending...":"Send Reset Link"})]})})})]})]})})}export{H 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.