"use strict";(()=>{vare={};e.id=2655,e.ids=[2655],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},21572:e=>{e.exports=require("nodemailer")},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")},96762:(e,t)=>{Object.defineProperty(t,"M",{enumerable:!0,get:function(){returnfunctione(t,r){returnrint?t[r]:"then"int&&"function"==typeoft.then?t.then(t=>e(t,r)):"function"==typeoft&&"default"===r?t:void0}}})},67136:(e,t,r)=>{r.r(t),r.d(t,{config:()=>f,default:()=>S,routeModule:()=>_});vars={};r.r(s),r.d(s,{default:()=>d});varn=r(89947),o=r(2706),a=r(96762),i=r(91766),l=r.n(i);r(6420);letc=r(29021),u=r(79531),p=r(82703);asyncfunctiond(e,t){if("GET"===e.method){letr=p(JSON.stringify({email:e.query.email,dateCode:Date.now()})),s=process.env.DSQL_HOST,n=e.query.email;if(!String(n).match(/.*@.*\..*/))returnt.json({user:null,msg:"Invalid Email"});leto=e.headers["x-real-ip"]||e.headers["x-forwarded-for"]||e.connection.remoteAddress,a=process.env.DSQL_HOST||"https://datasquirel.com",i=awaitu({to:e.query.email?.toString()||process.env.DSQL_CONTACT_EMAIL,subject:"Reset Your Password",text:"Please click the link to reset your password",html:c.readFileSync("./email/send-password-reset-link.html","utf8").replace(/{{host}}/,s||"").replace(/{{ip}}/,String(o)).replace(/{{token}}/,r||""),alias:"Support"});if(awaitl()(),u({to:process.env.DSQL_CONTACT_EMAIL,subject:`Password Reset Attempt for ${n}`,html:`<h1><u>${n}</u> tried to reset password</h1><p><b>${n}</b> attempted a password reset on ${a} from ${o} with a wrong password.</p>`}),!i)returnt.json({success:!1});t.json({success:!0})}}letS=(0,a.M)(s,"default"),f=(0,a.M)(s,"config"),_=newn.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/sendPasswordResetLink",pathname:"/api/sendPasswordResetLink",bundlePath:"",filename:""},userland:s})},91766:e=>{e.exports=asyncfunction(e){returnawaitnewPromise((t,r)=>{setTimeout(()=>{t(!0)},e||1e3)}),!0}},79531:(e,t,r)=>{lets=r(29021),n=r(21572).createTransport({host:process.env.DSQL_MAIL_HOST,port:465,secure:!0,auth:{user:process.env.DSQL_MAIL_EMAIL,pass:process.env.DSQL_MAIL_PASSWORD}});e.exports=asyncfunction({to:e,subject:t,text:r,html:o,alias:a}){leti;if(!process.env.DSQL_MAIL_HOST||!process.env.DSQL_MAIL_EMAIL||!process.env.DSQL_MAIL_PASSWORD)returnnull;letl=(a?.match(/support/i),process.env.DSQL_MAIL_EMAIL);if(!s.existsSync("./email/index.html"))return;letc=s.readFileSync("./email/index.html","utf8").replace(/{{email_body}}/,o||"").replace(/{{issue_date}}/,Date().substring(0,24));try{lets={};s.from=`"Datasquirel" <${l}>`,s.sender=l,a&&(s["replyTo "]=l),s.to=e,s.subject=t,s.text=r,s.html=c,i=awaitn.sendMail(s)}catch(e){console.log("ERROR in handleNodemailer Function =>",e.message)}returni}},6420:(e,t,r)=>{r(81630);lets=r(51348),n=r(72907),o=r(29021);asyncfunctiona(e,t,r,a){if(!e.cookies?.datasquirelAuthKey?.match(/./))returnnull;leti=n(e.cookies.datasquirelAuthKey);if(!i)returnnull;letl=JSON.parse(i);if(!l.csrf_k||r&&!e.headers["x-csrf-auth"]?.match(RegExp(`${l.csrf_k}`)))returnnull;letc=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!c)returnconsole.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(r&&!o.existsSync(`${c}/${l.csrf_k}`))returnnull;if(0==l.verification_status&&!r){lete=awaits(`SELECT verification_status FROM users WHERE id='${l.id}'`);e&&e[0]&&1==e[0].verification_status&&t.setHeader("Set-Cookie",["user_refresh=1"])}returnl?.date&&Date.now()-l.date>6048e5?null:l}e.exports=a},72907:(e,t,r)=>{let{scryptSync:s,createDecipheriv:n}=r(55511),{Buffer:o}=r(79428);e.exports=e=>{lett=n("aes-192-cbc",s(process.env.DSQL_ENCRYPTION_PASSWORD||"",process.env.DSQL_ENCRYPTION_SALT||"",24),o.alloc(16,0));try{letr=t.update(e,"hex","utf8");returnr+=t.final("utf8")}catch(e){returnnull}}},82703:(e,t,r)=>{let{scryptSync:s,createCipheriv:n}=r(55511),{Buffer:o}=r(79428)