1 line
8.5 KiB
JavaScript
1 line
8.5 KiB
JavaScript
"use strict";(()=>{var e={};e.id=613,e.ids=[613],e.modules={1068:(e,t,r)=>{r.a(e,async(e,a)=>{try{r.r(t),r.d(t,{config:()=>m,default:()=>u,getServerSideProps:()=>f,getStaticPaths:()=>p,getStaticProps:()=>h,reportWebVitals:()=>w,routeModule:()=>b,unstable_getServerProps:()=>j,unstable_getServerSideProps:()=>Z,unstable_getStaticParams:()=>y,unstable_getStaticPaths:()=>x,unstable_getStaticProps:()=>g});var s=r(7093),n=r(5244),l=r(1323),i=r(1070),c=r(3893),o=r(1560),d=e([c,o]);[c,o]=d.then?(await d)():d;let u=(0,l.l)(o,"default"),h=(0,l.l)(o,"getStaticProps"),p=(0,l.l)(o,"getStaticPaths"),f=(0,l.l)(o,"getServerSideProps"),m=(0,l.l)(o,"config"),w=(0,l.l)(o,"reportWebVitals"),g=(0,l.l)(o,"unstable_getStaticProps"),x=(0,l.l)(o,"unstable_getStaticPaths"),y=(0,l.l)(o,"unstable_getStaticParams"),j=(0,l.l)(o,"unstable_getServerProps"),Z=(0,l.l)(o,"unstable_getServerSideProps"),b=new s.PagesRouteModule({definition:{kind:n.x.PAGES,page:"/auth/signup",pathname:"/auth/signup",bundlePath:"",filename:""},components:{App:c.default,Document:i.default},userland:o});a()}catch(e){a(e)}})},7831:(e,t,r)=>{r.a(e,async(e,a)=>{try{r.d(t,{Z:()=>c});var s=r(3893),n=r(975),l=r(6689),i=e([s]);function c({new_deployment_user:e}){let{pageProps:t}=(0,l.useContext)(s.AppContext),[r,a]=(0,l.useState)({}),{loading:i,setLoading:c}=(0,n.Z)(),[o,d]=(0,l.useState)(!1);return{newUser:r,setNewUser:a,loading:i,setLoading:c,isPasswordConfirmed:o,setIsPasswordConfirmed:d,pageProps:t}}s=(i.then?(await i)():i)[0],a()}catch(e){a(e)}})},5711:(e,t,r)=>{r.a(e,async(e,a)=>{try{r.d(t,{Z:()=>u});var s=r(997),n=r(6248),l=r(8006),i=r(3216),c=r(7831),o=r(7344),d=e([n,l,i,c]);function u({new_deployment_user:e}){let{newUser:t,setNewUser:r,loading:a,setLoading:d,isPasswordConfirmed:u,setIsPasswordConfirmed:h,pageProps:p}=(0,c.Z)({new_deployment_user:e}),f=!!(u&&t.password?.match(/./)&&t.confirmed_password?.match(/./));return s.jsx("form",{onSubmit:e=>{e.preventDefault()},children:(0,s.jsxs)(i.Z,{className:"w-full items-stretch gap-6",children:[s.jsx(n.Z,{placeholder:"Eg. John",title:"First Name",changeHandler:e=>{r(t=>({...t,first_name:e}))},required:!0,showLabel:!0}),s.jsx(n.Z,{placeholder:"Eg. Doe",title:"Last Name",changeHandler:e=>{r(t=>({...t,last_name:e}))},showLabel:!0}),s.jsx(n.Z,{placeholder:"Email Address",title:"Email",type:"email",changeHandler:e=>{r(t=>({...t,email:e}))},required:!0,showLabel:!0}),p.user.id?s.jsx(n.Z,{placeholder:"Username",title:"Username",changeHandler:e=>{r(t=>({...t,username:e}))},validationRegex:/^[a-z0-9\-]{3,}$/,info:(0,s.jsxs)(s.Fragment,{children:["Allowed characters:"," ",s.jsx("code",{children:s.jsx("b",{children:"a-z, 0-9, -"})}),"."]}),wrapperWrapperProps:{className:"items-start!"},required:!0,showLabel:!0}):null,s.jsx(n.Z,{placeholder:"Password",title:"Password",type:"password",changeHandler:e=>{r(t=>({...t,password:e}))},validity:{isValid:!(t.password?.match(/./)&&t.confirmed_password?.match(/./))||f,msg:"Passwords don't match"},required:!0,showLabel:!0}),s.jsx(n.Z,{placeholder:"Confirm Password",title:"Confirm Password",type:"password",changeHandler:e=>{r(t=>({...t,confirmed_password:e})),h(e==t.password)},showLabel:!0}),s.jsx(l.Z,{title:"Login",onClick:()=>{f&&window.confirm("Create Super Admin Account?")&&(d(!0),(0,o.Z)("/api/auth/signup",{method:"POST",body:{new_user:t}}).then(e=>{console.log("res",e),e.success&&window.location.reload()}).finally(()=>{}))},loading:a,children:p.user.super_admin?"Add User":"Signup"})]})})}[n,l,i,c]=d.then?(await d)():d,a()}catch(e){a(e)}})},8194:(e,t,r)=>{r.a(e,async(e,a)=>{try{r.d(t,{Z:()=>o});var s=r(997),n=r(1309),l=r(3216),i=r(5711),c=e([n,l,i]);function o(){return(0,s.jsxs)(l.Z,{className:"w-full items-center max-w-lg",children:[s.jsx(n.Z,{children:"Create Super Admin Account"}),s.jsx(i.Z,{})]})}[n,l,i]=c.then?(await c)():c,a()}catch(e){a(e)}})},9177:(e,t,r)=>{r.a(e,async(e,a)=>{try{r.d(t,{Z:()=>m});var s=r(997),n=r(1817),l=r(1048),i=r(5808),c=r(2984),o=r(4519),d=r(9705),u=r(736),h=r(6245),p=r(3216),f=e([l,i,c,o,d,u,h,p]);function m({children:e}){return s.jsx(o.Z,{className:"w-screen h-screen overflow-hidden",children:s.jsx(u.Z,{className:"w-full h-full",children:s.jsx(i.Z,{className:"grid-frame grid-cols-1 h-full",children:(0,s.jsxs)(p.Z,{className:"w-full justify-between h-full grid-cell",children:[(0,s.jsxs)(p.Z,{className:"gap-0",children:[(0,s.jsxs)(d.Z,{children:[s.jsx(d.Z,{className:"p-6",children:s.jsx(n.Z,{})}),s.jsx(c.Z,{vertical:!0})]}),s.jsx(c.Z,{})]}),s.jsx(l.Z,{className:"p-10",children:e}),(0,s.jsxs)(p.Z,{children:[s.jsx(c.Z,{}),s.jsx(h.Z,{className:"h-20 w-full"})]})]})})})})}[l,i,c,o,d,u,h,p]=f.then?(await f)():f,a()}catch(e){a(e)}})},1560:(e,t,r)=>{r.a(e,async(e,a)=>{try{r.r(t),r.d(t,{default:()=>d,getServerSideProps:()=>u});var s=r(997),n=r(8194),l=r(9177),i=r(8804),c=r.n(i),o=e([n,l]);function d(){return s.jsx(l.Z,{children:s.jsx(n.Z,{})})}[n,l]=o.then?(await o)():o;let u=async e=>{let t=await c().select({table:"users"});return t.payload?.[0]?{redirect:{destination:"/auth/login",statusCode:307}}:{props:{}}};a()}catch(e){a(e)}})},1048:(e,t,r)=>{r.a(e,async(e,a)=>{try{r.d(t,{Z:()=>i});var s=r(997),n=r(8097),l=e([n]);function i({...e}){return s.jsx("div",{...e,className:(0,n.twMerge)("flex flex-col items-center justify-center gap-4 p-2 w-full","h-full twui-center",e.className),children:e.children})}n=(l.then?(await l)():l)[0],a()}catch(e){a(e)}})},5808:(e,t,r)=>{r.a(e,async(e,a)=>{try{r.d(t,{Z:()=>i});var s=r(997),n=r(8097),l=e([n]);function i({...e}){return s.jsx("div",{...e,className:(0,n.twMerge)("flex w-full max-w-container gap-4 justify-between","flex-wrap flex-col xl:flex-row items-start xl:items-center","twui-container",e.className),children:e.children})}n=(l.then?(await l)():l)[0],a()}catch(e){a(e)}})},1309:(e,t,r)=>{r.a(e,async(e,a)=>{try{r.d(t,{Z:()=>i});var s=r(997),n=r(8097),l=e([n]);function i({...e}){return s.jsx("h2",{...e,className:(0,n.twMerge)("text-2xl md:text-3xl mb-4","twui-headings twui-heading","twui-h2",e.className),children:e.children})}n=(l.then?(await l)():l)[0],a()}catch(e){a(e)}})},736:(e,t,r)=>{r.a(e,async(e,a)=>{try{r.d(t,{Z:()=>i});var s=r(997),n=r(8097),l=e([n]);function i({...e}){return s.jsx("section",{...e,className:(0,n.twMerge)("flex flex-col items-center w-full","px-4 sm:px-10 py-10","twui-section",e.className),children:e.children})}n=(l.then?(await l)():l)[0],a()}catch(e){a(e)}})},6245:(e,t,r)=>{r.a(e,async(e,a)=>{try{r.d(t,{Z:()=>i});var s=r(997),n=r(8097),l=e([n]);function i({horizontal:e,...t}){return s.jsx("div",{...t,className:(0,n.twMerge)("",e?"w-10":"w-full h-10","twui-spacer",t.className),children:t.children})}n=(l.then?(await l)():l)[0],a()}catch(e){a(e)}})},7344:(e,t,r)=>{r.d(t,{Z:()=>l});var a=r(6517),s=r.n(a);let n={stringify:function(e,t,r){try{return JSON.stringify(e,t||void 0,r)}catch(e){return}}};async function l(e,t){let r;let a={"Content-Type":"application/json"};t?.csrfKey&&t.csrfValue&&(a[t.csrfKey]=t.csrfValue);let l=e;if(t?.query&&(l+=function(e){let t="?";if("object"!=typeof e)return console.log("Invalid Query type"),t;if(Array.isArray(e))return console.log("Query is an Array. This is invalid."),t;if(!e)return console.log("No Query provided."),t;let r=Object.keys(e),a=[];return r.forEach(t=>{if(!t||!e[t])return;let r=e[t];if("object"==typeof r){let e=n.stringify(r);a.push(`${t}=${encodeURIComponent(String(e))}`)}else"string"==typeof r||"number"==typeof r?a.push(`${t}=${encodeURIComponent(r)}`):a.push(`${t}=${String(r)}`)}),t+=a.join("&")}(t.query)),"string"==typeof t)try{r="post"===t?(await fetch(l,{method:t,headers:a})).json():(await fetch(l)).json()}catch(e){console.log("FetchAPI error #1:",e.message),r=null}else if("object"==typeof t)try{let e;if(t.body&&"object"==typeof t.body){let e=s().cloneDeep(t.body);t.body=JSON.stringify(e)}if(t.headers){t.headers=s().merge(t.headers,a);let r={...t};e=await fetch(l,r)}else{let r={...t,headers:a};e=await fetch(l,r)}r=e.json()}catch(e){console.log("FetchAPI error #2:",e.message),r=null}else try{let e=await fetch(l);r=await e.json()}catch(e){console.log("FetchAPI error #3:",e.message),r=null}return r}},8804:e=>{e.exports=require("@moduletrace/nsqlite")},6517:e=>{e.exports=require("lodash")},2423:e=>{e.exports=require("lucide-react")},2785:e=>{e.exports=require("next/dist/compiled/next-server/pages.runtime.prod.js")},6689:e=>{e.exports=require("react")},6405:e=>{e.exports=require("react-dom")},997:e=>{e.exports=require("react/jsx-runtime")},5315:e=>{e.exports=require("path")},8097:e=>{e.exports=import("tailwind-merge")}};var t=require("../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),a=t.X(0,[859,800,752,248],()=>r(1068));module.exports=a})(); |