"use strict";(()=>{vare={};e.id=9187,e.ids=[9187],e.modules={43499:e=>{e.exports=require("@moduletrace/datasquirel/functions/hashPassword")},27825:e=>{e.exports=require("lodash")},75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},72583:e=>{e.exports=require("sanitize-html")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},49915:(e,r,s)=>{s.r(r),s.d(r,{config:()=>m,default:()=>_,routeModule:()=>S});vart={};s.r(t),s.d(t,{default:()=>f});vara=s(89947),i=s(2706),n=s(96762),o=s(43499),l=s.n(o),u=s(6420),c=s.n(u),d=s(47670),p=s.n(d);asyncfunctionf(e,r){if("POST"!==e.method)returnr.json({msg:"Failed!"});if(!awaitc()(e,r,!0))returnr.json({success:!1,msg:"Unauthorized"});let{payload:s,dbFullName:t,dbId:a}=e.body,i=awaitp()({dbContext:"Dsql User",paradigm:"Full Access",dbFullName:t,tableName:"users",data:(()=>{lete=Object.keys(s),r={};returne.forEach(e=>{e?.match(/paradigm|priviledge|database_access|databases|confirm/)||(r[e]=s[e])}),r.password=l()({encryptionKey:process.env.DSQL_ENCRYPTION_PASSWORD||"",password:s.password}),r.email=s.email_address,r.image="/images/user-preset.png",r.image_thumbnail="/images/user-preset-thumbnail.png",deleter.email_address,r})()});r.json({success:!!i?.insertId,msg:"New User User Added",newUserId:i.insertId})}let_=(0,n.M)(t,"default"),m=(0,n.M)(t,"config"),S=newa.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/addDbUser",pathname:"/api/addDbUser",bundlePath:"",filename:""},userland:t})},6420:(e,r,s)=>{s(81630);lett=s(51348),a=s(72835),i=s(29021),n=s(31341);asyncfunctiono(e,r,s,o){let{keyCookieName:l,csrfCookieName:u}=n();if(!e.cookies?.[l]?.match(/./))returnnull;letc=a({encryptedString:e.cookies[l]});if(!c)returnnull;letd=JSON.parse(c);if(!d.csrf_k||s&&!e.headers["x-csrf-auth"]?.match(RegExp(`${d.csrf_k}`)))returnnull;letp=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!p)returnconsole.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(s&&!i.existsSync(`${p}/${d.csrf_k}`))returnnull;if(0==d.verification_status&&!s){lete=awaitt(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}returnd?.date&&Date.now()-d.date>6048e5?null:d}e.exports=o},31341:e=>{e.exports=function(){lete=process.env.DSQL_COOKIES_PREFIX||"dsql_";return{keyCookieName:e+(process.env.DSQL_COOKIES_KEY_NAME||"key"),csrfCookieName:e+(process.env.DSQL_COOKIES_CSRF_NAME||"csrf")}}},72835:(e,r,s)=>{let{scryptSync:t,createDecipheriv:a}=s(55511),{Buffer:i}=s(79428);e.exports=({encryptedString:e,encryptionKey:r,encryptionSalt:s})=>{if(!e?.match(/./))returnconsole.log("Encrypted string is invalid"),e;letn=r||process.env.DSQL_ENCRYPTION_PASSWORD,o=s||process.env.DSQL_ENCRYPTION_SALT,l=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!n?.match(/.{8,}/))returnconsole.log("Decrption key is invalid"),e;if(!o?.match(/.{8,}/))returnconsole.log("Decrption salt is invalid"),e;letu=a("aes-192-cbc",t(n,o,l),i.alloc(16,0));try{letr=u.update(e,"hex","utf8");returnr+=u.final("utf8")}catch(r){returnconsole.log("Error in decrypting =>",r.message),e}}}};varr=require("../../webpack-api-runtime.js");r.C(e);vars=e=>r(r.s=e),t=r.X(0,[4050],()=>s(49915));module.exports=t})();