(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2162],{6762:(e,t,s)=>{Promise.resolve().then(s.bind(s,72427))},50627:(e,t,s)=>{"use strict";var r=s(47192);s.o(r,"notFound")&&s.d(t,{notFound:function(){return r.notFound}}),s.o(r,"useParams")&&s.d(t,{useParams:function(){return r.useParams}}),s.o(r,"usePathname")&&s.d(t,{usePathname:function(){return r.usePathname}}),s.o(r,"useRouter")&&s.d(t,{useRouter:function(){return r.useRouter}}),s.o(r,"useSearchParams")&&s.d(t,{useSearchParams:function(){return r.useSearchParams}})},72427:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>o});var r=s(73365),a=s(1521),n=s(50627);function o(){let[e,t]=(0,a.useState)(""),[s,o]=(0,a.useState)(!1),[l,d]=(0,a.useState)(null),[u,i]=(0,a.useState)(null),c=(0,n.useRouter)(),m=async t=>{t.preventDefault(),o(!0),i(null),d(null);try{let t=await fetch("/api/auth/forgot-password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e})}),s=await t.json();if(!t.ok)throw Error(s.message||"Something went wrong");d(s.message||"If the email exists, a reset link has been sent")}catch(e){i(e.message)}finally{o(!1)}};return(0,r.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 py-12 px-4 sm:px-6 lg:px-8",children:(0,r.jsxs)("div",{className:"max-w-md w-full space-y-8 bg-white p-8 rounded-lg shadow",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"mt-6 text-center text-3xl font-extrabold text-gray-900",children:"Forgot your password?"}),(0,r.jsx)("p",{className:"mt-2 text-center text-sm text-gray-600",children:"Enter your email and we'll send you a reset link"})]}),u&&(0,r.jsx)("div",{className:"bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative",children:u}),l&&(0,r.jsx)("div",{className:"bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded relative",children:l}),(0,r.jsxs)("form",{className:"mt-8 space-y-6",onSubmit:m,children:[(0,r.jsx)("div",{className:"rounded-md shadow-sm space-y-4",children:(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{htmlFor:"email",className:"block text-sm font-medium text-gray-700 mb-2",children:"Email address"}),(0,r.jsx)("input",{id:"email",name:"email",type:"email",autoComplete:"email",required:!0,value:e,onChange:e=>t(e.target.value),className:"mt-1 appearance-none block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm placeholder-gray-400 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm text-gray-700",placeholder:"you@example.com"})]})}),(0,r.jsx)("div",{children:(0,r.jsx)("button",{type:"submit",disabled:s,className:"w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed",children:s?"Sending...":"Send Reset Link"})})]}),(0,r.jsx)("div",{className:"text-center",children:(0,r.jsx)("button",{onClick:()=>c.push("/login"),className:"text-sm text-blue-600 hover:text-blue-500",children:"Back to login"})})]})})}}},e=>{var t=t=>e(e.s=t);e.O(0,[2347,4870,7358],()=>t(6762)),_N_E=e.O()}]);