(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9327],{7:(e,s,t)=>{Promise.resolve().then(t.bind(t,5223))},5223:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>m});var a=t(5155),r=t(2115),l=t(2177),n=t(5695),i=t(6874),c=t.n(i),o=t(9805);function m(){let[e,s]=(0,r.useState)(!1),[t,i]=(0,r.useState)(""),[m,d]=(0,r.useState)(!1),x=(0,n.useRouter)(),{register:u,handleSubmit:h,formState:{errors:p}}=(0,l.mN)(),g=async e=>{let{email:t}=e;s(!0),i("");try{let{status:s,message:a}=(await o.A.post("/auth/forget-password",{email:t,site:"geenrecept.com"})).data;console.log(e),localStorage.setItem("geenrecept_reset_email",JSON.stringify(t)),s?(d(!0),x.push("/verify_otp")):i(a)}catch(e){i("Failed to send OTP. Please try again.")}finally{s(!1)}};return(0,a.jsxs)("div",{className:" bg-gray-50 flex flex-col justify-center py-12 sm:px-6 lg:px-8",children:[(0,a.jsxs)("div",{className:"sm:mx-auto sm:w-full sm:max-w-md",children:[(0,a.jsx)("h2",{className:"mt-6 text-center text-3xl font-extrabold text-gray-900",children:"Wachtwoord vergeten"}),(0,a.jsxs)("p",{className:"mt-2 text-center text-sm text-gray-600 ",children:["Voer je e-mailadres in en we sturen je een OTP-code ",(0,a.jsx)("br",{})," om je wachtwoord te resetten"]})]}),(0,a.jsx)("div",{className:"mt-8 sm:mx-auto sm:w-full sm:max-w-md",children:(0,a.jsxs)("div",{className:"bg-white py-8 px-4 shadow sm:rounded-lg sm:px-10",children:[t&&(0,a.jsx)("div",{className:"mb-4 bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative",role:"alert",children:(0,a.jsx)("span",{className:"block sm:inline",children:t})}),m&&(0,a.jsx)("div",{className:"mb-4 bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded relative",role:"alert",children:(0,a.jsx)("span",{className:"block sm:inline",children:"OTP-code is verzonden naar je e-mailadres. Je wordt doorgestuurd..."})}),(0,a.jsxs)("form",{className:"space-y-6",onSubmit:h(g),children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:"email",className:"block text-sm font-medium text-gray-700",children:"E-mailadres"}),(0,a.jsxs)("div",{className:"mt-1",children:[(0,a.jsx)("input",{id:"email",name:"email",type:"email",autoComplete:"email",required:!0,className:"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-teal-500 focus:border-teal-500 sm:text-sm",...u("email",{required:"E-mail is verplicht",pattern:{value:/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,message:"Ongeldig e-mailadres"}})}),p.email&&(0,a.jsx)("p",{className:"mt-2 text-sm text-red-600",children:p.email.message})]})]}),(0,a.jsx)("div",{children:(0,a.jsx)("button",{type:"submit",disabled:e,className:"w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-teal-600 hover:bg-teal-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-teal-500 disabled:opacity-50",children:e?(0,a.jsxs)("span",{className:"flex items-center",children:[(0,a.jsxs)("svg",{className:"animate-spin -ml-1 mr-3 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,a.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,a.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Versturen..."]}):"Verstuur OTP-code"})})]}),(0,a.jsx)("div",{className:"mt-6",children:(0,a.jsx)("div",{className:"text-center",children:(0,a.jsxs)("p",{className:"text-sm text-gray-600",children:["Terug naar"," ",(0,a.jsx)(c(),{href:"/login",className:"font-medium text-teal-600 hover:text-teal-500",children:"Inloggen"})]})})})]})})]})}},9805:(e,s,t)=>{"use strict";t.d(s,{A:()=>r});let a=t(3464).A.create({baseURL:"https://chat.nextjspanel.com/api/v1"});a.interceptors.request.use(e=>{{let s=JSON.parse(localStorage.getItem("medication-auth-token")||"null");s&&(e.headers.Authorization="Bearer ".concat(s))}return e},e=>Promise.reject(e));let r=a}},e=>{var s=s=>e(e.s=s);e.O(0,[6874,3464,8243,8441,1684,7358],()=>s(7)),_N_E=e.O()}]);