dsql-admin/dsql-app/.local_dist/static/chunks/pages/reset-password-aa61ba3768f9e7a8.js
Benjamin Toby 3ffd2d6777 Updates
2024-12-05 08:03:33 +01:00

1 line
2.9 KiB
JavaScript

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7537],{13792:(e,s,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/reset-password",function(){return a(18969)}])},70385:(e,s,a)=>{"use strict";a.d(s,{A:()=>r});var t=a(74848);function r(e){let{message:s,className:a}=e;return(0,t.jsxs)("div",{className:"info green"+(a?" "+a:""),children:[(0,t.jsx)("img",{src:"/images/checkmark.svg",alt:"Warning Image Icon",width:22,className:"-my-2"}),(0,t.jsx)("span",{children:s})]})}a(96540)},18969:(e,s,a)=>{"use strict";a.r(s),a.d(s,{ResetPasswordContext:()=>w,__N_SSP:()=>m,default:()=>p});var t=a(74848),r=a(96540),n=a(93444),i=a(96411),o=a(620),l=a(23698),c=a(70385),d=a(2543),u=a.n(d),m=!0;let w=r.createContext({});function p(e){let{email:s}=e,a="Reset Password | Datasquirel",d="Set a new password",m=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("title",{children:a}),(0,t.jsx)("meta",{name:"description",content:d}),(0,t.jsx)(i.A,{pageTitle:a,pageDescription:d,pagePathname:"/"})]}),[p,h]=r.useState(!1),[x,g]=r.useState(!1);return(0,t.jsx)(n.A,{head:m,user:e.user,children:(0,t.jsx)(w.Provider,{value:{user:e.user},children:(0,t.jsx)("main",{children:(0,t.jsxs)("section",{children:[p&&(0,t.jsx)(o.A,{}),(0,t.jsx)("div",{className:"main-container flex-col items-start",children:x?(0,t.jsx)(c.A,{message:"Password Updated Sucessfully. Redirecting you ..."}):(0,t.jsxs)(r.Fragment,{children:[(0,t.jsx)("h1",{className:"m-0 text-4xl",children:"Reset Password"}),(0,t.jsx)("span",{children:"Please enter new passord and confirm it"}),(0,t.jsxs)("form",{className:"max-w-xl w-full flex flex-col items-stretch gap-4",onSubmit:e=>{h(!0),e.preventDefault();let a=e.target,t=a.password.value,r=a["confirm-password"].classList.contains("warning");if((null==t?void 0:t.length)<8){window.alert("Password must be at least 8 characters"),setTimeout(()=>{h(!1)},500);return}if(r){window.alert("Passwords don't match"),setTimeout(()=>{h(!1)},500);return}(0,l.A)("/api/resetPassword?email=".concat(s,"&password=").concat(t)).then(e=>{setTimeout(()=>{h(!1)},500),setTimeout(()=>{window.location.href="/logout?login=true"},1e3),e.success&&g(!0)})},children:[(0,t.jsx)("input",{type:"password",name:"password",id:"password",className:"w-full",placeholder:"New Password",required:!0}),(0,t.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,a=s.closest("form");try{a.password.value.match(new RegExp("^".concat(u().escapeRegExp(s.value),"$")))?s.classList.remove("warning"):s.classList.add("warning")}catch(s){(0,l.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,t.jsx)("button",{children:"Reset Password"})]})]})})]})})})})}}},e=>{var s=s=>e(e.s=s);e.O(0,[1570,636,6593,8792],()=>s(13792)),_N_E=e.O()}]);