dsql-admin/dsql-app/.local_dist/static/chunks/pages/reset-password-a754110c3b3e20fb.js
2024-11-05 12:12:42 +01:00

1 line
3.1 KiB
JavaScript

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8006],{60249:function(e,s,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/reset-password",function(){return n(65082)}])},82186:function(e,s,n){"use strict";n.d(s,{Z:function(){return a}});var t=n(85893);n(67294);function a(e){var s=e.message,n=e.className;return(0,t.jsxs)("div",{className:"info green"+(n?" "+n:""),children:[(0,t.jsx)("img",{src:"/images/checkmark.svg",alt:"Warning Image Icon",width:22,className:"-my-2"}),(0,t.jsx)("span",{children:s})]})}},65082:function(e,s,n){"use strict";n.r(s),n.d(s,{ResetPasswordContext:function(){return f},__N_SSP:function(){return p},default:function(){return h}});var t=n(828),a=n(85893),r=n(67294),i=n(56217),o=n(24097),c=n(95264),d=n(86729),l=n(82186),u=n(96486),m=n.n(u),w={},p=!0,f=r.createContext(w);function h(e){var s=e.email,n="Reset Password | Datasquirel",u="Set a new password",w=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("title",{children:n}),(0,a.jsx)("meta",{name:"description",content:u}),(0,a.jsx)(o.Z,{pageTitle:n,pageDescription:u,pagePathname:"/"})]}),p=(0,t.Z)(r.useState(!1),2),h=p[0],x=p[1],g=(0,t.Z)(r.useState(!1),2),v=g[0],j=g[1];return(0,a.jsx)(i.Z,{head:w,user:e.user,children:(0,a.jsx)(f.Provider,{value:{user:e.user},children:(0,a.jsx)("main",{children:(0,a.jsxs)("section",{children:[h&&(0,a.jsx)(c.Z,{}),(0,a.jsx)("div",{className:"main-container flex-col items-start",children:v?(0,a.jsx)(l.Z,{message:"Password Updated Sucessfully. Redirecting you ..."}):(0,a.jsxs)(r.Fragment,{children:[(0,a.jsx)("h1",{className:"m-0 text-4xl",children:"Reset Password"}),(0,a.jsx)("span",{children:"Please enter new passord and confirm it"}),(0,a.jsxs)("form",{className:"max-w-xl w-full flex flex-col items-stretch gap-4",onSubmit:function(e){x(!0),e.preventDefault();var n=e.target,t=n.password.value,a=n["confirm-password"].classList.contains("warning");return(null===t||void 0===t?void 0:t.length)<8?(window.alert("Password must be at least 8 characters"),void setTimeout((function(){x(!1)}),500)):a?(window.alert("Passwords don't match"),void setTimeout((function(){x(!1)}),500)):void(0,d.Z)("/api/resetPassword?email=".concat(s,"&password=").concat(t)).then((function(e){setTimeout((function(){x(!1)}),500),setTimeout((function(){window.location.href="/logout?login=true"}),1e3),e.success&&j(!0)}))},children:[(0,a.jsx)("input",{type:"password",name:"password",id:"password",className:"w-full",placeholder:"New Password",required:!0}),(0,a.jsx)("input",{type:"password",name:"confirm-password",id:"confirm-password",className:"w-full",placeholder:"Confirm New Password",required:!0,onInput:function(e){var s=e.target,n=s.closest("form");try{n.password.value.match(new RegExp("^".concat(m().escapeRegExp(s.value),"$")))?(s.classList.remove("warning"),!0):s.classList.add("warning")}catch(t){(0,d.Z)("/api/admin/clientError",{method:"post",body:{component:"reset-password-page-component/lines-170-177",message:t.message,user:{}}}),e.target.classList.add("warning")}}}),(0,a.jsx)("button",{children:"Reset Password"})]})]})})]})})})})}}},function(e){e.O(0,[3662,9774,2888,179],(function(){return s=60249,e(e.s=s);var s}));var s=e.O();_N_E=s}]);