Files
dsql-admin/dsql-app/.local_dist/static/chunks/pages/login-888ba76adaccfcb5.js
T
2025-02-12 17:56:44 +01:00

1 line
4.7 KiB
JavaScript

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[676],{7864:(e,s,t)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/login",function(){return t(5386)}])},4329:(e,s,t)=>{"use strict";t.d(s,{A:()=>l});var r=t(4848);t(6540);var a=t(1710);function l(){return(0,r.jsx)("div",{className:"flex flex-col gap-4 items-center justify-center w-full h-screen p-6 bg-slate-100",children:(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center gap-4 px-6 py-20 bg-white rounded shadow-sm max-w-2xl w-full",children:[(0,r.jsx)("img",{src:"/images/logo-icon-alt-2.webp",alt:"Datasquirel Logo",width:60}),(0,r.jsx)("div",{className:"w-10 h-10 flex flex-col items-center justify-center",children:(0,r.jsx)(a.A,{width:"25px",position:"relative"})})]})})}},8058:(e,s,t)=>{"use strict";function r(e){let{user:s,setLoading:t}=e;return null}t.d(s,{A:()=>r}),t(4848),t(6540),t(1335),t(9020),t(8133),t(1212)},1212:(e,s,t)=>{"use strict";t.d(s,{B:()=>r});let r={OneTimeEmail:"one-time-login-email",User:"user",CSRF:"csrf"}},5386:(e,s,t)=>{"use strict";t.r(s),t.d(s,{__N_SSP:()=>v,default:()=>w});var r=t(4848),a=t(6540),l=t(3368),n=t.n(l),i=t(9020),o=t(1335),c=t.n(o);async function d(e){let{e:s,setAlert:t,setLoading:r,query:a}=e;s.preventDefault(),r(!0);let l=s.target["email-or-username-input"],n=s.target.password;if((null==l?void 0:l.value)===""&&(null==n?void 0:n.value)===""){l.classList.add("warning"),n.classList.add("warning"),t("No Email or Password Provided"),r(!1);return}if((null==n?void 0:n.value)===""){t(!1),n.classList.add("warning"),t(!0),r(!1);return}l.classList.remove("warning"),n.classList.remove("warning"),t(!1);let o={email:l.value,password:n.value,query:a};(0,i.A)("/api/loginUser",{method:"post",body:o}).then(e=>{var s;e.success&&(null===(s=e.payload)||void 0===s?void 0:s.logged_in_status)?(c().auth.postLogin(e),window.location.reload()):e.msg&&(t(e.msg),r(!1))})}var u=t(1710),m=t(8058);let x=a.createContext({});function f(e){let{user:s,query:t}=e,[l,n]=(0,a.useState)(!1),[i,o]=(0,a.useState)(!1);return(0,r.jsxs)(x.Provider,{value:{loading:i,setLoading:o,alert:l,setAlert:n,user:s},children:[(0,r.jsx)(m.A,{user:s,setLoading:o}),(0,r.jsxs)("div",{className:"w-full justify-center relative",children:[(0,r.jsx)("span",{className:"bg-white dark:bg-slate-800 px-3 relative z-10",children:"OR"}),(0,r.jsx)("hr",{className:"absolute"})]}),(0,r.jsxs)("div",{className:"w-full flex-col items-stretch gap-4",children:[i&&(0,r.jsx)(u.A,{}),l&&(0,r.jsx)("div",{className:"p-2 justify-center text-sm border border-solid border-orange-400 rounded bg-orange-50",children:l}),(0,r.jsxs)("form",{className:"flex flex-col gap-2 w-full",onSubmit:e=>{d({e,setAlert:n,setLoading:o,query:t})},children:[(0,r.jsx)("input",{type:"text",name:"email-or-username-input",id:"email-or-username-input",placeholder:"Email or username",defaultValue:(null==t?void 0:t.email)?t.email:"",required:!0,onInput:e=>{l&&n(!1)}}),(0,r.jsx)("input",{type:"password",name:"password",id:"password-input",placeholder:"Password",required:!0,onInput:e=>{l&&n(!1)}}),(0,r.jsx)("button",{type:"submit",children:"Login"})]}),(0,r.jsx)("div",{className:"flex flex-col items-center w-full mb-2",children:(0,r.jsx)("a",{href:"/send-password-reset-link",className:"text-secondary font-semibold",children:"Forgot Password?"})}),(0,r.jsxs)("div",{className:"flex items-center gap-2 justify-center w-full mb-2 flex-wrap",children:[(0,r.jsx)("span",{children:"Dont have an account yet?"}),(0,r.jsx)("a",{href:"/create-account",className:"text-secondary font-semibold",children:"Register Now"})]}),(0,r.jsxs)("div",{className:"justify-center text-sm text-secondary",children:[(0,r.jsx)("a",{href:"/terms",className:"text-secondary",children:"Terms and Conditions"}),(0,r.jsx)("a",{href:"/privacy",className:"text-secondary",children:"Privacy Policy"})]})]})]})}var h=t(6232),p=t(4329),v=!0;function w(e){return(a.useEffect(()=>{setTimeout(()=>{e.query.invite&&e.user&&(window.location.pathname="/create-account")},1e3),e.query.invite||localStorage.setItem("user","{}")},[]),e.query.invite&&e.user)?(0,r.jsx)(p.A,{}):(0,r.jsxs)(a.Fragment,{children:[(0,r.jsxs)(n(),{children:[(0,r.jsx)("title",{children:"Login to your account"}),(0,r.jsx)("meta",{name:"description",content:"Login to your account"})]}),(0,r.jsx)("main",{className:"w-screen h-screen flex items-center justify-center p-4 md:p-8",children:(0,r.jsxs)("div",{className:"card col items-center no-hover max-w-md w-full bg-white p-4 sm:p-6 overflow-auto minimal-scrollbars",style:{maxHeight:"calc(100vh - 40px)"},children:[(0,r.jsx)(h.A,{}),(0,r.jsx)("hr",{}),(0,r.jsx)("h3",{className:"m-0 text-lg font-semibold",children:"Login to your account"}),(0,r.jsx)(f,{user:e.user,query:e.query})]})})]})}}},e=>{var s=s=>e(e.s=s);e.O(0,[1335,636,6593,8792],()=>s(7864)),_N_E=e.O()}]);