dsql-admin/dsql-app/.local_dist/server/pages/api/resetPassword.js

1 line
2.3 KiB
JavaScript
Raw Normal View History

2024-12-05 07:03:33 +00:00
"use strict";(()=>{var e={};e.id=9971,e.ids=[9971],e.modules={43499:e=>{e.exports=require("@moduletrace/datasquirel/functions/hashPassword")},75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},9973:e=>{e.exports=require("serverless-mysql")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,s){return s in r?r[s]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,s)):"function"==typeof r&&"default"===s?r:void 0}}})},24127:(e,r,s)=>{s.r(r),s.d(r,{config:()=>P,default:()=>l,routeModule:()=>f});var t={};s.r(t),s.d(t,{default:()=>p});var n=s(89947),o=s(2706),a=s(96762),i=s(51348),u=s.n(i),c=s(43499),d=s.n(c);async function p(e,r){if("GET"!==e.method)return r.json({msg:"UNauthorized"});{let{email:s,password:t}=e.query,n=d()({encryptionKey:process.env.DSQL_ENCRYPTION_PASSWORD||"",password:String(t)}),o=await u()(`UPDATE users SET password='${n}' WHERE email='${s}'`);r.json({success:!!o?.affectedRows})}}s(29021);let l=(0,a.M)(t,"default"),P=(0,a.M)(t,"config"),f=new n.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/resetPassword",pathname:"/api/resetPassword",bundlePath:"",filename:""},userland:t})},51348:(e,r,s)=>{let t=s(9973),n=s(21580),o=t({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:n()}});async function a(...e){try{let r=await o.query(...e);return await o.end(),JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}}e.exports=a},21580:(e,r,s)=>{let t=s(29021);e.exports=function(){let e=process.env.DSQL_SSL_DIR;if(!e?.match(/./))return;let r=`${e}/ca-cert.pem`;if(!t.existsSync(r)){console.log(`${r} does not exist`);return}return{ca:t.readFileSync(`${e}/ca-cert.pem`)}}},2706:(e,r)=>{var s;Object.defineProperty(r,"A",{enumerable:!0,get:function(){return s}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(s||(s={}))},89947:(e,r,s)=>{e.exports=s(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var s=r(r.s=24127);module.exports=s})();