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

16 lines
17 KiB
JavaScript
Raw Normal View History

2024-12-05 07:03:33 +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:()=>q,default:()=>y,getServerSideProps:()=>D,getStaticPaths:()=>v,getStaticProps:()=>E,reportWebVitals:()=>b,routeModule:()=>L,unstable_getServerProps:()=>w,unstable_getServerSideProps:()=>R,unstable_getStaticParams:()=>j,unstable_getStaticPaths:()=>P,unstable_getStaticProps:()=>A});var s={};r.r(s),r.d(s,{CreateAccountContext:()=>h,default:()=>x,getServerSideProps:()=>S});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(22172),r(67216),r(93353),r(32415),r(63715);var f=r(55966);let h=d().createContext({});function x(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 S({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"),q=(0,n.M)(s,"config"),b=(0,n.M)(s,"reportWebVitals"),A=(0,n.M)(s,"unstable_getStaticProps"),P=(0,n.M)(s,"unstable_getStaticPaths"),j=(0,n.M)(s,"unstable_getStaticParams"),w=(0,n.M)(s,"unstable_getServerProps"),R=(0,n.M)(s,"unstable_getServerSideProps"),L=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"})})]})})}},22172:(e,t,r)=>{r(29021),r(28187);let s=r(68942),a=r(67216),i=r(43290);e.exports=async function({query:e,user:t}){try{let{invite:r,database_access:s,priviledge:n,email:o}=e,l=await a("SELECT date_created_code FROM invitations WHERE inviting_user_id=? AND invited_user_email=?",[r,o]);if(!l||!l[0])throw Error("No Invitation Found");let u=await a("SELECT first_name,last_name,email FROM users WHERE id=?",[r]);if(u?.[0]){let e=await a("SELECT email FROM user_users WHERE user_id=? AND invited_user_id=? AND user_type='admin' AND email=?",[r,t.id,o]
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-05 07:03:33 +00:00
${l}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},20048:(e,t,r)=>{r(81630);let s=r(67216),a=r(83007),i=r(29021);async function n(e,t,r,n){if(!e.cookies?.datasquirelAuthKey?.match(/./))return null;let o=a(e.cookies.datasquirelAuthKey);if(!o)return null;let l=JSON.parse(o);if(!l.csrf_k||r&&!e.headers["x-csrf-auth"]?.match(RegExp(`${l.csrf_k}`)))return null;let u=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!u)return console.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(r&&!i.existsSync(`${u}/${l.csrf_k}`))return null;if(0==l.verification_status&&!r){let e=await s(`SELECT verification_status FROM users WHERE id='${l.id}'`);e&&e[0]&&1==e[0].verification_status&&t.setHeader("Set-Cookie",["user_refresh=1"])}return l?.date&&Date.now()-l.date>6048e5?null:l}e.exports=n},43290:(e,t,r)=>{let s=r(81339),a=r(72583),i=r(67942);r(19760);let n=r(19760);r(27825);let o=r(67216),l=r(1231);async function u({dbContext:e,paradigm:t,dbFullName:r,tableName:u,data:c,tableSchema:d,duplicateColumnName:p,duplicateColumnValue:m,update:_,encryptionKey:g,encryptionSalt:f}){let h=!e?.match(/dsql.user/i)&&(!r||!!r.match(/^datasquirel$/)),x=h?o:l;if(c?.date_created_timestamp&&delete c.date_created_timestamp,c?.date_updated_timestamp&&delete c.date_updated_timestamp,c?.date_updated&&delete c.date_updated,c?.date_updated_code&&delete c.date_updated_code,c?.date_created&&delete c.date_created,c?.date_created_code&&delete c.date_created_code,p&&"string"==typeof p){let s=h?await x(`SELECT * FROM \`${u}\` WHERE \`${p}\`=?`,[m]):await x({paradigm:"Read Only",database:r,queryString:`SELECT * FROM \`${u}\` WHERE \`${p}\`=?`,queryValues:[m]});if(s?.[0]&&!_)return null;if(s&&s[0]&&_)return await n({dbContext:e,paradigm:t,dbFullName:r,tableName:u,data:c,tableSchema:d,encryptionKey:g,encryptionSalt:f,identifierColumnName:p,identifierValue:m||""})}let S=Object.keys(c),y=[],E=[];for(let e=0;e<S.length;e++)try{let t=S[e],r=c?.[t],n=d?d?.fields?.filter(e=>e.fieldName==t):null,o=n&&n[0]?n[0]:null;if(null==r||void 0==r||o?.dataType?.match(/int$/i)&&"string"==typeof r&&!r?.match(/./))continue;o?.encrypted&&(r=s(r,g,f),console.log("DSQL: Encrypted value =>",r)),o?.richText&&(r=a(r,i)),o?.pattern&&!new RegExp(o.pattern,o.patternFlags||"").test(r)&&(console.log("DSQL: Pattern not matched =>",r),r=""),y.push("`"+t+"`"),"object"==typeof r&&(r=JSON.stringify(r)),"number"==typeof r?E.push(String(r)):E.push(r)}catch(e){console.log("DSQL: Error in parsing data keys =>",e.message);continue}c?.date_created||(y.push("`date_created`"),E.push(Date())),c?.date_created_code||(y.push("`date_created_code`"),E.push(Date.now())),c?.date_updated||(y.push("`date_updated`"),E.push(Date())),c?.date_updated_code||(y.push("`date_updated_code`"),E.push(Date.now()));let v=`INSERT INTO \`${u}\` (${y.join(",")}) VALUES (${E.map(()=>"?").join(",")})`;return h?await x(v,E):await x({paradigm:t,database:r,queryString:v,queryValues:E})}e.exports=u},19760:(e,t,r)=>{let s=r(81339),a=r(72583),i=r(67942),n=r(67216),o=r(1231);async function l({dbContext:e,paradigm:t,dbFullName:r,tableName:l,data:u,tableSchema:c,identifierColumnName:d,identifierValue:p,encryptionKey:m,encryptionSalt:_}){if(!u||!Object.keys(u).length)return null;let g=!e?.match(/dsql.user/i)&&(!r||!!r.match(/^datasquirel$/)),f=g?n:o,h=Object.keys(u),x=[],S=[];for(let e=0;e<h.length;e++)try{let t=h[e],r=u[t],n=c?c?.fields?.filter(e=>e.fieldName===t):null,o=n&&n[0]?n[0]:null;if(null==r||void 0==r)continue;o?.richText&&(r=a(r,i)),o?.encrypted&&(r=s(r,m,_)),"object"==typeof r&&(r=JSON.stringify(r)),o?.pattern&&!new RegExp(o.pattern,o.patternFlags||"").test(r)&&(console.log("DSQL: Pattern not matched =>",r),r=""),"string"==typeof r&&r.match(/^null$/i)&&(r={toSqlString:function(){return"NULL"}}),"string"!=typeof r||r.match(/./i)||(r={toSqlString:function(){return"NULL"}}),x.push(`\`${t}\`=?`),"number"==typeof r?S.push(String(r)):S.push(r)}catch(e){console.log("DSQL: Error in parsing data keys in update function =>",e.message);continue}x.push(`date_updated='${Date()}'`),x.push(`date_updated