(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8697],{8413:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>d});var a=s(5155),r=s(2115),l=s(2177),n=s(5695),c=s(6874),o=s.n(c),i=s(9805);function d(){let[e,t]=(0,r.useState)(!1),[s,c]=(0,r.useState)(""),[d,m]=(0,r.useState)(""),[u,x]=(0,r.useState)(""),h=(0,n.useRouter)(),[p,f]=(0,r.useState)(!0),{register:g,handleSubmit:j,formState:{errors:w}}=(0,l.mN)();console.log(p),(0,r.useLayoutEffect)(()=>{let e=localStorage.getItem("geenrecept_reset_email");if(!e){h.push("/forgot_password");return}m(JSON.parse(e)),f(!1)},[h]);let b=async e=>{if(e.preventDefault(),t(!0),c(""),6===u.length)try{let e=await i.A.post("/auth/verify-otp",{email:d,otp:u}),{status:t,message:s}=await e.data;t?(localStorage.setItem("geenrecept_reset_otp",u),h.push("/reset_password")):c(s)}catch(e){c("Failed to verify OTP. Please try again.")}else c("Invalid OTP");t(!1)};return(0,a.jsxs)("div",{className:"m 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:"Verifieer OTP-code"}),(0,a.jsxs)("p",{className:"mt-2 text-center text-sm text-gray-600",children:["Voer de 6-cijferige code in die we naar ",d," hebben gestuurd"]})]}),p?(0,a.jsx)("div",{className:"mt-8 sm:mx-auto sm:w-full sm:max-w-md",children:(0,a.jsxs)("div",{className:"animate-pulse bg-white py-8 px-4  shadow sm:rounded-lg sm:px-10 h-[232px] w-[448px] flex  flex-col space-y-4 justify-center",children:[(0,a.jsx)("div",{className:"h-10 bg-gray-300 rounded full"}),(0,a.jsx)("div",{className:"h-10 bg-gray-300 rounded w-full"})]})}):(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:[s&&(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:s})}),(0,a.jsxs)("form",{className:"space-y-6",onSubmit:b,children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{htmlFor:"otp",className:"block text-sm font-medium text-gray-700",children:"OTP-code"}),(0,a.jsx)("div",{className:"mt-1",children:(0,a.jsx)("input",{id:"otp",name:"otp",type:"text",required:!0,value:u,onChange:e=>{let t=e.target.value;/^\d*$/.test(t)&&t.length<=6&&x(t)},placeholder:"Voer 6-cijferige code in",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||6!==u.length,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"})]}),"Verifi\xebren..."]}):"Verifieer OTP"})})]}),(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:["Geen code ontvangen?"," ",(0,a.jsx)(o(),{href:"/auth/forgot_password",className:"font-medium text-teal-600 hover:text-teal-500",children:"Opnieuw versturen"})]})})})]})})]})}},9189:(e,t,s)=>{Promise.resolve().then(s.bind(s,8413))},9805:(e,t,s)=>{"use strict";s.d(t,{A:()=>r});let a=s(3464).A.create({baseURL:"https://chat.nextjspanel.com/api/v1"});a.interceptors.request.use(e=>{{let t=JSON.parse(localStorage.getItem("medication-auth-token")||"null");t&&(e.headers.Authorization="Bearer ".concat(t))}return e},e=>Promise.reject(e));let r=a}},e=>{var t=t=>e(e.s=t);e.O(0,[6874,3464,8243,8441,1684,7358],()=>t(9189)),_N_E=e.O()}]);