(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7537],{2710:(e,s,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/reset-password",function(){return t(2939)}])},4179:(e,s,t)=>{"use strict";t.d(s,{A:()=>a});var r=t(4848);function a(e){let{message:s,className:t}=e;return(0,r.jsxs)("div",{className:"info green"+(t?" "+t:""),children:[(0,r.jsx)("img",{src:"/images/checkmark.svg",alt:"Warning Image Icon",width:22,className:"-my-2"}),(0,r.jsx)("span",{children:s})]})}t(6540)},9625:(e,s,t)=>{"use strict";t.d(s,{A:()=>o});var r=t(4848),a=t(3430),n=t(6540);function o(e){var s;let{pageTitle:t,pageDescription:o,pagePathname:i,aceEditor:c}=e,{DSQL_HOST:l}=(null===(s=n.useContext(a.AppContext).pageProps)||void 0===s?void 0:s.appData)||{DSQL_HOST:"https://datasquirel.com"};return(0,r.jsxs)(n.Fragment,{children:[(0,r.jsx)("link",{rel:"canonical",href:l+i}),(0,r.jsx)("meta",{property:"og:url",content:l+i}),(0,r.jsx)("meta",{itemProp:"url",content:l+i}),(0,r.jsx)("meta",{name:"twitter:url",content:l+i}),(0,r.jsx)("meta",{property:"og:title",content:t}),(0,r.jsx)("meta",{property:"og:description",content:o}),(0,r.jsx)("meta",{itemProp:"name",content:t}),(0,r.jsx)("meta",{itemProp:"description",content:o}),(0,r.jsx)("meta",{name:"twitter:title",content:t}),(0,r.jsx)("meta",{name:"twitter:description",content:o}),c&&(0,r.jsxs)(n.Fragment,{children:[(0,r.jsx)("script",{src:"https://cdnjs.cloudflare.com/ajax/libs/ace/1.22.0/ace.min.js",integrity:"sha512-q6CTB0jS+VuJnSct82rVcWlI06LGzNjaG3CWenHWVUncRvc4UQMFkA3a5Ip880xr+lBx38FcHDclOxPdSg+sBw==",crossOrigin:"anonymous",referrerPolicy:"no-referrer"}),(0,r.jsx)("script",{src:"https://cdnjs.cloudflare.com/ajax/libs/ace/1.22.0/ext-language_tools.min.js",integrity:"sha512-6g6cvocV7eT/J8L44lL8gJKqq9onqQeYGgJO0DmrsYFcCfRl6wYkYA/KHS768r4QVTB4JxsCcMQ9gIezxpTCZw==",crossOrigin:"anonymous",referrerPolicy:"no-referrer"})]})]})}},2939:(e,s,t)=>{"use strict";t.r(s),t.d(s,{ResetPasswordContext:()=>u,__N_SSP:()=>p,default:()=>x});var r=t(4848),a=t(6540),n=t(8883),o=t(9625),i=t(1710),c=t(9020),l=t(4179),d=t(2543),m=t.n(d),p=!0;let u=a.createContext({});function x(e){let{email:s}=e,t="Reset Password | Datasquirel",d="Set a new password",p=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("title",{children:t}),(0,r.jsx)("meta",{name:"description",content:d}),(0,r.jsx)(o.A,{pageTitle:t,pageDescription:d,pagePathname:"/"})]}),[x,w]=a.useState(!1),[g,j]=a.useState(!1);return(0,r.jsx)(n.A,{head:p,user:e.user,children:(0,r.jsx)(u.Provider,{value:{user:e.user},children:(0,r.jsx)("main",{children:(0,r.jsxs)("section",{children:[x&&(0,r.jsx)(i.A,{}),(0,r.jsx)("div",{className:"main-container flex-col items-start",children:g?(0,r.jsx)(l.A,{message:"Password Updated Sucessfully. Redirecting you ..."}):(0,r.jsxs)(a.Fragment,{children:[(0,r.jsx)("h1",{className:"m-0 text-4xl",children:"Reset Password"}),(0,r.jsx)("span",{children:"Please enter new passord and confirm it"}),(0,r.jsxs)("form",{className:"max-w-xl w-full flex flex-col items-stretch gap-4",onSubmit:e=>{w(!0),e.preventDefault();let t=e.target,r=t.password.value,a=t["confirm-password"].classList.contains("warning");if((null==r?void 0:r.length)<8){window.alert("Password must be at least 8 characters"),setTimeout(()=>{w(!1)},500);return}if(a){window.alert("Passwords don't match"),setTimeout(()=>{w(!1)},500);return}(0,c.A)("/api/resetPassword?email=".concat(s,"&password=").concat(r)).then(e=>{setTimeout(()=>{w(!1)},500),setTimeout(()=>{window.location.href="/logout?login=true"},1e3),e.success&&j(!0)})},children:[(0,r.jsx)("input",{type:"password",name:"password",id:"password",className:"w-full",placeholder:"New Password",required:!0}),(0,r.jsx)("input",{type:"password",name:"confirm-password",id:"confirm-password",className:"w-full",placeholder:"Confirm New Password",required:!0,onInput:e=>{let s=e.target,t=s.closest("form");try{t.password.value.match(new RegExp("^".concat(m().escapeRegExp(s.value),"$")))?s.classList.remove("warning"):s.classList.add("warning")}catch(s){(0,c.A)("/api/admin/clientError",{method:"post",body:{component:"reset-password-page-component/lines-170-177",message:s.message,user:{}}}),e.target.classList.add("warning")}}}),(0,r.jsx)("button",{children:"Reset Password"})]})]})})]})})})})}}},e=>{var s=s=>e(e.s=s);e.O(0,[636,6593,8792],()=>s(2710)),_N_E=e.O()}]);