dsql-admin/dsql-app/.local_dist/static/chunks/pages/reset-password-404836a50d6e9e32.js

1 line
4.2 KiB
JavaScript
Raw Normal View History

2025-01-13 08:00:21 +00:00
(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:()=>n});var r=t(4848),a=t(6540);function n(e){let{pageTitle:s,pageDescription:t,pagePathname:n,aceEditor:o}=e;return(0,r.jsxs)(a.Fragment,{children:[(0,r.jsx)("link",{rel:"canonical",href:"http://localhost:7070"+n}),(0,r.jsx)("meta",{property:"og:url",content:"http://localhost:7070"+n}),(0,r.jsx)("meta",{itemProp:"url",content:"http://localhost:7070"+n}),(0,r.jsx)("meta",{name:"twitter:url",content:"http://localhost:7070"+n}),(0,r.jsx)("meta",{property:"og:title",content:s}),(0,r.jsx)("meta",{property:"og:description",content:t}),(0,r.jsx)("meta",{itemProp:"name",content:s}),(0,r.jsx)("meta",{itemProp:"description",content:t}),(0,r.jsx)("meta",{name:"twitter:title",content:s}),(0,r.jsx)("meta",{name:"twitter:description",content:t}),o&&(0,r.jsxs)(a.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:()=>w});var r=t(4848),a=t(6540),n=t(4252),o=t(9625),c=t(1710),i=t(9020),l=t(4179),d=t(2543),m=t.n(d),p=!0;let u=a.createContext({});function w(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:"/"})]}),[w,x]=a.useState(!1),[h,g]=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:[w&&(0,r.jsx)(c.A,{}),(0,r.jsx)("div",{className:"main-container flex-col items-start",children:h?(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=>{x(!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(()=>{x(!1)},500);return}if(a){window.alert("Passwords don't match"),setTimeout(()=>{x(!1)},500);return}(0,i.A)("/api/resetPassword?email=".concat(s,"&password=").concat(r)).then(e=>{setTimeout(()=>{x(!1)},500),setTimeout(()=>{window.location.href="/logout?login=true"},1e3),e.success&&g(!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,i.A)("/api/admin/clientError",{method:"post",body:{component:"reset-password-page-component/lines-170-177",message:s.message,user:{}}}),e.target.classLis