(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8459],{2283:(e,s,t)=>{Promise.resolve().then(t.bind(t,9731))},9731:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>n});var a=t(5155),r=t(2115),l=t(2177),o=t(5695),c=t(9805);function n(){let[e,s]=(0,r.useState)(!1),[t,n]=(0,r.useState)(""),[d,i]=(0,r.useState)(""),[m,u]=(0,r.useState)(""),[p,x]=(0,r.useState)(""),h=(0,o.useRouter)(),{register:w,handleSubmit:f,formState:{errors:g},watch:b}=(0,l.mN)();b("password",""),(0,r.useLayoutEffect)(()=>{let e=localStorage.getItem("geenrecept_reset_email"),s=localStorage.getItem("geenrecept_reset_otp");e&&s?(i(JSON.parse(e)),u(s)):h.push("/auth/forgot_password")},[h]);let y=async e=>{e.preventDefault(),s(!0),n("");try{let e=await c.A.post("/auth/password-reset",{email:d,password:p,otp:m}),{status:t,message:a}=await e.data;if(!t){s(!1),n(a);return}localStorage.removeItem("geenrecept_reset_email"),localStorage.removeItem("geenrecept_reset_otp"),h.push("/login")}catch(e){n("Failed to reset password. 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:"Reset je wachtwoord"}),(0,a.jsx)("p",{className:"mt-2 text-center text-sm text-gray-600",children:"Voer je nieuwe wachtwoord in"})]}),(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})}),(0,a.jsxs)("form",{className:"space-y-6",onSubmit:y,children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:"password",className:"block text-sm font-medium text-gray-700",children:"Nieuw wachtwoord"}),(0,a.jsx)("div",{className:"mt-1",children:(0,a.jsx)("input",{id:"password",name:"password",type:"password",required:!0,value:p,onChange:e=>x(e.target.value),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"})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:"confirmPassword",className:"block text-sm font-medium text-gray-700",children:"Bevestig nieuw wachtwoord"}),(0,a.jsx)("div",{className:"mt-1",children:(0,a.jsx)("input",{id:"confirmPassword",name:"confirmPassword",type:"password",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"})})]}),(0,a.jsx)("div",{children:(0,a.jsx)("button",{type:"submit",disabled:e||!p,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"})]}),"Resetten..."]}):"Reset wachtwoord"})})]})]})})]})}},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,[3464,8243,8441,1684,7358],()=>s(2283)),_N_E=e.O()}]);