(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4984],{85510:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/forgot-password/otp-verification",function(){return n(85199)}])},85199:function(e,t,n){"use strict";n.r(t);var r=n(85893),o=n(41664),i=n.n(o),s=n(67294),a=n(11163),l=n(11057),d=n(15861),p=n(99226),c=n(98396),u=n(90948),g=n(2734);n(82381);var x=n(58386),h=n(11431),f=n(81805);n(23020);var m=n(87066),y=n(81406),w=n(86501);(0,u.ZP)("img")(e=>{let{theme:t}=e;return{zIndex:2,maxHeight:650,marginTop:t.spacing(12),marginBottom:t.spacing(12),[t.breakpoints.down(1540)]:{maxHeight:550},[t.breakpoints.down("lg")]:{maxHeight:500}}}),(0,u.ZP)(p.Z)(e=>{let{theme:t}=e;return{width:"100%",[t.breakpoints.up("md")]:{maxWidth:450},[t.breakpoints.up("lg")]:{maxWidth:600},[t.breakpoints.up("xl")]:{maxWidth:750}}});let b=(0,u.ZP)(p.Z)(e=>{let{theme:t}=e;return{position:"relative",width:"100%",maxWidth:450,backgroundColor:"white",boxShadow:"0 4px 30px rgba(0, 0, 0, 0.1)",borderRadius:"20px",padding:t.spacing(6),display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",opacity:"0.9",zIndex:2}}),j=(0,u.ZP)(p.Z)(e=>{let{theme:t}=e;return{height:"100vh",width:"100%",display:"flex",justifyContent:"center",alignItems:"center",backgroundImage:"url(/images/pages/pexels-freestocks-291762.jpg)",backgroundSize:"cover",backgroundPosition:"center",backgroundRepeat:"no-repeat",padding:t.spacing(2),position:"relative","&:before":{content:'""',position:"absolute",top:0,left:0,width:"100%",height:"100%",background:"rgba(0, 0, 0, 0.5)",zIndex:1},"& > *":{zIndex:2}}});(0,u.ZP)(p.Z)(e=>{let{theme:t}=e;return{position:"absolute",top:t.spacing(8),left:t.spacing(6)}});let Z=(0,u.ZP)(i())(e=>{let{theme:t}=e;return{display:"flex",alignItems:"center",textDecoration:"none",justifyContent:"center",color:t.palette.primary.main,fontSize:t.typography.body1.fontSize,"& img":{borderRadius:"10px"}}}),ForgotPassword=()=>{let e=(0,a.useRouter)(),t=(0,g.Z)(),[n,o]=(0,s.useState)(),[i,u]=(0,s.useState)("");(0,c.Z)(t.breakpoints.down("md"));let f=[],handleOtp=e=>{o(e)};async function Verify(){var t;let n={email:i,otp:f[0]};if(!((null==n?void 0:null===(t=n.otp)||void 0===t?void 0:t.length)<6)&&(null==n?void 0:n.otp))try{let t=await m.Z.post("".concat(y.Ao,"/api/platform-user/otp"),n);console.log("response",t),e.push("/forgot-password/confirmpassword"),w.ZP.success(t.data.message,{duration:2e3})}catch(e){console.error("Error:",e),w.ZP.error(e.response.data.message,{duration:2e3})}else alert("Please enter a valid otp")}return f.push(n),(0,s.useEffect)(()=>{u(JSON.parse(window.localStorage.getItem("userEmail")))},[i]),(0,r.jsx)(j,{children:(0,r.jsx)(b,{children:(0,r.jsx)(p.Z,{sx:{p:[3],height:"70%",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,r.jsxs)(p.Z,{sx:{width:"100%",maxWidth:400},children:[(0,r.jsx)(Z,{href:"/",children:(0,r.jsx)("img",{width:"150",alt:"logo",src:"/images/logos/logo-chataak.jpg"})}),(0,r.jsxs)(p.Z,{sx:{my:6},children:[(0,r.jsx)(d.Z,{sx:{mb:1.5,fontWeight:500,fontSize:"1.625rem",lineHeight:1.385},children:"Verify Otp"}),(0,r.jsx)(d.Z,{sx:{color:"text.secondary"},children:"Enter your Otp and we′ll send you instructions to reset your password"})]}),(0,r.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",marginBottom:"25px"},children:(0,r.jsx)(x.Z,{value:n,onChange:e=>handleOtp(e),sx:{mb:4},numInputs:6,renderSeparator:(0,r.jsx)("span",{children:"\xa0\xa0"}),renderInput:e=>(0,r.jsx)("input",{...e,style:{width:"60px",height:"50px",textAlign:"center"}})})}),(0,r.jsx)(l.Z,{fullWidth:!0,type:"button",onClick:()=>Verify(),variant:"contained",sx:{mb:4},children:"Next"}),(0,r.jsx)(d.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"center","& svg":{mr:1}},children:(0,r.jsxs)(Z,{href:"/login",children:[(0,r.jsx)(h.Z,{fontSize:"1.25rem",icon:"tabler:chevron-left"}),(0,r.jsx)("span",{children:"Back to login"})]})})]})})})})};ForgotPassword.getLayout=e=>(0,r.jsx)(f.Z,{children:e}),ForgotPassword.guestGuard=!0,t.default=ForgotPassword}},function(e){e.O(0,[60,9774,2888,179],function(){return e(e.s=85510)}),_N_E=e.O()}]);