dsql-admin/dsql-app/.local_dist/server/pages/create-account.js

16 lines
19 KiB
JavaScript
Raw Normal View History

2024-12-06 13:24:26 +00:00
"use strict";(()=>{var e={};e.id=8810,e.ids=[636,8810],e.modules={30671:(e,t)=>{Object.defineProperty(t,"M",{enumerable:!0,get:function(){return function e(t,r){return r in t?t[r]:"then"in t&&"function"==typeof t.then?t.then(t=>e(t,r)):"function"==typeof t&&"default"===r?t:void 0}}})},90467:(e,t,r)=>{r.r(t),r.d(t,{config:()=>b,default:()=>y,getServerSideProps:()=>D,getStaticPaths:()=>v,getStaticProps:()=>E,reportWebVitals:()=>q,routeModule:()=>j,unstable_getServerProps:()=>A,unstable_getServerSideProps:()=>R,unstable_getStaticParams:()=>L,unstable_getStaticPaths:()=>P,unstable_getStaticProps:()=>N});var s={};r.r(s),r.d(s,{CreateAccountContext:()=>h,default:()=>S,getServerSideProps:()=>x});var a=r(63865),i=r(9455),n=r(30671),o=r(49407),l=r(68268),u=r(8732),c=r(82015),d=r.n(c),p=r(71457),m=r(87472),_=r(70045);function g(e){let{query:t,invitingUser:r}=d().useContext(h);return(0,u.jsxs)("section",{className:"flex-col items-center lg:items-center gap-20 p-0",children:[(0,u.jsx)("img",{src:"/images/grid.webp",alt:"Dotted image background",className:"absolute top-0 left-0 w-full h-full object-cover opacity-80 dark:opacity-10 z-0"}),(0,u.jsxs)("div",{className:"w-full lg:w-1/2 max-w-6xl gap-4 flex-col items-center px-4 py-10 bg-white dark:bg-slate-900 relative z-10",children:[r?.first_name&&(0,u.jsxs)("span",{className:"text-xs bg-emerald-100 rounded-full px-4 py-1 mb-4",children:["You have been invited by"," ",(0,u.jsxs)("b",{children:[r.first_name," ",r.last_name," (",r.email,")"]})," ","to manage an account. Please create an account to gain access."]}),(0,u.jsx)("h1",{className:"m-0 text-center text-2xl",children:"Create An Account"}),(0,u.jsx)(_.A,{query:t})]})]})}r(20048),r(26123),r(67216),r(63715);var f=r(55966);r(6505);let h=d().createContext({});function S(e){let t="Create Account | Datasquirel",r="Create a FREE account and start storing data.",s=(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("title",{children:t}),(0,u.jsx)("meta",{name:"description",content:r}),(0,u.jsx)(m.A,{pageTitle:t,pageDescription:r,pagePathname:"/"})]}),[a,i]=d().useState(null);return e.query?.invite?(0,u.jsx)(f.A,{}):(0,u.jsx)(p.A,{head:s,children:(0,u.jsx)(h.Provider,{value:{user:a,query:e.query,invitingUser:e.invitingUser},children:(0,u.jsx)("main",{children:(0,u.jsx)(g,{})})})})}async function x({req:e,res:t,query:r}){return{redirect:{destination:"/login",permanent:!1}}}let y=(0,n.M)(s,"default"),E=(0,n.M)(s,"getStaticProps"),v=(0,n.M)(s,"getStaticPaths"),D=(0,n.M)(s,"getServerSideProps"),b=(0,n.M)(s,"config"),q=(0,n.M)(s,"reportWebVitals"),N=(0,n.M)(s,"unstable_getStaticProps"),P=(0,n.M)(s,"unstable_getStaticPaths"),L=(0,n.M)(s,"unstable_getStaticParams"),A=(0,n.M)(s,"unstable_getServerProps"),R=(0,n.M)(s,"unstable_getServerSideProps"),j=new a.PagesRouteModule({definition:{kind:i.A.PAGES,page:"/create-account",pathname:"/create-account",bundlePath:"",filename:""},components:{App:l.default,Document:o.default},userland:s})},55966:(e,t,r)=>{r.d(t,{A:()=>i});var s=r(8732);r(82015);var a=r(32415);function i(){return(0,s.jsx)("div",{className:"flex flex-col gap-4 items-center justify-center w-full h-screen p-6 bg-slate-100",children:(0,s.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,s.jsx)("img",{src:"/images/logo-icon-alt-2.webp",alt:"Datasquirel Logo",width:60}),(0,s.jsx)("div",{className:"w-10 h-10 flex flex-col items-center justify-center",children:(0,s.jsx)(a.A,{width:"25px",position:"relative"})})]})})}},20048:(e,t,r)=>{r(81630);let s=r(67216),a=r(77463),i=r(29021),n=r(6505);async function o(e,t,r,o){let{keyCookieName:l,csrfCookieName:u}=n();if(!e.cookies?.[l]?.match(/./))return null;let c=a({encryptedString:e.cookies[l]});if(!c)return null;let d=JSON.parse(c);if(!d.csrf_k||r&&!e.headers["x-csrf-auth"]?.match(RegExp(`${d.csrf_k}`)))return null;let p=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!p)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(r&&!i.existsSync(`${p}/${d.csrf_k}`))return null;if(0==
2024-12-05 07:03:33 +00:00
Error Message: ${t}
Component: ${r}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(a+=`
User Id: ${e?.id}
User Name: ${e?.first_name} ${e?.last_name}
User Email: ${e?.email}`),i?.url&&(a+=`
URL: ${i.url}`),i?.body&&(a+=`
Request Body: ${JSON.stringify(i.body,null,4)}`),o&&(a+=`
IP: ${o}`),a+=`
Date: ${n.toDateString()}
========================================`,s.existsSync("./.tmp/error.log")||s.writeFileSync("./.tmp/error.log","","utf-8");let l=s.readFileSync("./.tmp/error.log","utf-8");s.writeFileSync("./.tmp/error.log",a),s.appendFileSync("./.tmp/error.log",`
2024-11-05 11:12:42 +00:00
2024-12-06 13:24:26 +00:00
${l}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},77463:(e,t,r)=>{let{scryptSync:s,createDecipheriv:a}=r(55511),{Buffer:i}=r(79428);e.exports=({encryptedString:e,encryptionKey:t,encryptionSalt:r})=>{if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let n=t||process.env.DSQL_ENCRYPTION_PASSWORD,o=r||process.env.DSQL_ENCRYPTION_SALT,l=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!n?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!o?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let u=a("aes-192-cbc",s(n,o,l),i.alloc(16,0));try{let t=u.update(e,"hex","utf8");return t+=u.final("utf8")}catch(t){return console.log("Error in decrypting =>",t.message),e}}},53219:(e,t,r)=>{let{scryptSync:s,createCipheriv:a}=r(55511),{Buffer:i}=r(79428);e.exports=({data:e,encryptionKey:t,encryptionSalt:r})=>{if(!e?.match(/./))return console.log("Encryption string is invalid"),e;let n=t||process.env.DSQL_ENCRYPTION_PASSWORD,o=r||process.env.DSQL_ENCRYPTION_SALT,l=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!n?.match(/.{8,}/))return console.log("Encryption key is invalid"),e;if(!o?.match(/.{8,}/))return console.log("Encryption salt is invalid"),e;let u=a("aes-192-cbc",s(n,o,l),i.alloc(16,0));try{let t=u.update(e,"utf8","hex");return t+=u.final("hex")}catch(t){return console.log("Error in encrypting =>",t.message),e}}},67216:(e,t,r)=>{let s=r(9973),a=r(31976),i=s({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4",ssl:a()}});async function n(...e){try{let t=await i.query(...e);return await i.end(),JSON.parse(JSON.stringify(t))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=n},1231:(e,t,r)=>{let s=r(29021);r(33873);let a=r(9973),i=r(31976),n=a({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_READ_ONLY_USERNAME,password:process.env.DSQL_DB_READ_ONLY_PASSWORD,charset:"utf8mb4",ssl:i()}});e.exports=function({paradigm:e,database:t,queryString:r,queryValues:o}){try{return new Promise((l,u)=>{let c=!!e?.match(/full.access|^fa$/i);try{function d(e){n.end(),l(JSON.parse(JSON.stringify(e)))}function p(e){n.end(),l({error:e.message,queryStringGenerated:r,queryValuesGenerated:o,sql:e.sql})}n=c?a({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_FULL_ACCESS_USERNAME,password:process.env.DSQL_DB_FULL_ACCESS_PASSWORD,database:t,ssl:i()}}):a({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_READ_ONLY_USERNAME,password:process.env.DSQL_DB_READ_ONLY_PASSWORD,database:t,ssl:i()}}),o&&Array.isArray(o)&&o[0]?n.query(r,o).then(d).catch(p):n.query(r).then(d).catch(p)}catch(e){s.appendFileSync("./.tmp/dbErrorLogs.txt",e.message+"\n"+Date()+"\n\n\n","utf8"),l({error:e.message})}})}catch(e){return{success:!1,error:e.message}}}},88896:(e,t,r)=>{let s=r(9973),a=r(31976);async function i(...e){let t=s({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4",ssl:a()},onConnect:()=>{console.log("Connection Successful!")},onConnectError:e=>{console.log("Connection Error",e.message)},onError:e=>{console.log("Client Error",e.message)}});console.log("Querying ...");try{let r=await t.query(...e);return await t.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e.message),{success:!1,error:e.message}}}e.exports=i},31976:(e,t,r)=>{let s=r(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let t=`${e}/ca-cert.pem`;if(!s.existsSync(t)){console.log(`${t} does not exist`);return}return{ca:s.readFileSync(`${e}/ca-cert.pem`)}}},49407:(e,t,r)=>{r.r(t),r.d(t,{default:()=>i});var s=r(8732);r(82015);var a=r(20883);function i(e){retur