1 line
4.2 KiB
JavaScript
1 line
4.2 KiB
JavaScript
"use strict";(()=>{var e={};e.id=7714,e.ids=[7714],e.modules={39908:e=>{e.exports=require("@moduletrace/datasquirel/dist/users/user-auth")},75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},21572:e=>{e.exports=require("nodemailer")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},10942:(e,r,t)=>{t.r(r),t.d(r,{config:()=>A,default:()=>f,routeModule:()=>_});var n={};t.r(n),t.d(n,{default:()=>p});var i=t(89947),s=t(2706),o=t(96762),a=t(29021),l=t.n(a),c=t(69842),u=t(96052),d=t(68829);async function p(e,r){if("GET"===e.method){let t=await (0,c.A)(e,r);if(!t)return r.redirect(307,"/logout");let n=(0,d.A)({data:JSON.stringify({id:t.id,email:t.email,dateCode:Date.now()})}),i=process.env.DSQL_HOST;if(!await (0,u.A)({to:t.email,subject:"Verify Email Address",text:"Please click the link to verify your email address",html:l().readFileSync("./email/send-email-verification-link.html","utf8").replace(/{{host}}/,i||"").replace(/{{token}}/,n||"")}))return r.json({success:!1});r.json({success:!0})}}let f=(0,o.M)(n,"default"),A=(0,o.M)(n,"config"),_=new i.PagesAPIRouteModule({definition:{kind:s.A.PAGES_API,page:"/api/sendEmailVerificationLink",pathname:"/api/sendEmailVerificationLink",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>s});var n=t(39908),i=t.n(n);async function s(e,r,t){let n=i()({req:e,level:t?"deep":void 0});return console.log(n),n.payload}},96052:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(29021),i=t.n(n),s=t(21572);let o=t.n(s)().createTransport({host:process.env.DSQL_MAIL_HOST,port:465,secure:!0,auth:{user:process.env.DSQL_MAIL_EMAIL,pass:process.env.DSQL_MAIL_PASSWORD}});async function a({to:e,subject:r,text:t,html:n,alias:s,senderName:a}){let l;if(!process.env.DSQL_MAIL_HOST||!process.env.DSQL_MAIL_EMAIL||!process.env.DSQL_MAIL_PASSWORD)return null;let c=(s?.match(/support/i),process.env.DSQL_MAIL_EMAIL);if(!i().existsSync("./email/index.html"))return;let u=i().readFileSync("./email/index.html","utf8").replace(/{{email_body}}/,n||"").replace(/{{issue_date}}/,Date().substring(0,24));try{let n={};n.from=`"${a||"Datasquirel"}" <${c}>`,n.sender=c,s&&(n.replyTo=c),n.to=e,n.subject=r,n.text=t,n.html=u,l=await o.sendMail(n)}catch(e){console.log("ERROR in handleNodemailer Function =>",e.message)}return l}},68829:(e,r,t)=>{t.d(r,{A:()=>o});var n=t(55511),i=t(79428),s=t(32443);function o({data:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encryption string is invalid"),e;let{key:o,salt:a,keyLen:l,algorithm:c,bufferAllocSize:u}=(0,s.A)({encryptionKey:r});if(!o?.match(/.{8,}/))return console.log("Encryption key is invalid"),e;if(!a?.match(/.{8,}/))return console.log("Encryption salt is invalid"),e;let d=(0,n.scryptSync)(o,a,l),p=i.Buffer.alloc(u,0),f=(0,n.createCipheriv)(c,d,p);try{let r=f.update(e,"utf8","hex");return r+=f.final("hex")}catch(r){return console.log("Error in encrypting =>",r.message),e}}},32443:(e,r,t)=>{t.d(r,{A:()=>n});function n(e){return{key:e?.encryptionKey||process.env.DSQL_ENCRYPTION_PASSWORD,keyLen:process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24,salt:e?.encryptionSalt||process.env.DSQL_ENCRYPTION_SALT,apiKey:e?.apiKey||process.env.DSQL_API_KEY,algorithm:e?.algorithm||process.env.DSQL_ENCRYPTION_ALGORITHM||"aes-192-cbc",bufferAllocSize:e?.bufferAllocSize||(process.env.DSQL_ENCRYPTION_BUFFER_ALLOCATION_SIZE?function(e,r){try{let r=Number(e);if("number"!=typeof r||isNaN(r))return 0;return Math.round(r)}catch(e){return console.log(`Numberfy ERROR: ${e.message}`),0}}(process.env.DSQL_ENCRYPTION_BUFFER_ALLOCATION_SIZE):void 0)||16}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=10942);module.exports=t})(); |