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

96 lines
3.6 KiB
JavaScript
Raw Normal View History

2024-11-05 11:12:42 +00:00
"use strict";
(() => {
var exports = {};
exports.id = 6559;
exports.ids = [6559];
exports.modules = {
/***/ 2029:
/***/ ((module) => {
module.exports = require("datasquirel/functions/hashPassword");
/***/ }),
/***/ 2261:
/***/ ((module) => {
module.exports = require("serverless-mysql");
/***/ }),
/***/ 7147:
/***/ ((module) => {
module.exports = require("fs");
/***/ }),
/***/ 1017:
/***/ ((module) => {
module.exports = require("path");
/***/ }),
/***/ 2434:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ handler)
/* harmony export */ });
/* harmony import */ var _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2224);
/* harmony import */ var _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var datasquirel_functions_hashPassword__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2029);
/* harmony import */ var datasquirel_functions_hashPassword__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(datasquirel_functions_hashPassword__WEBPACK_IMPORTED_MODULE_1__);
// @ts-check
/**
* ==============================================================================
* Imports
* ==============================================================================
*/ const fs = __webpack_require__(7147);
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
* API handler
* ==============================================================================
* @type {import("next").NextApiHandler}
*/ async function handler(req, res) {
if (req.method === "GET") {
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
const { email , password } = req.query;
const hashedPassword = datasquirel_functions_hashPassword__WEBPACK_IMPORTED_MODULE_1___default()({
encryptionKey: process.env.DSQL_ENCRYPTION_PASSWORD || "",
password: String(password)
});
const updatePassword = await _package_shared_utils_backend_global_db_DB_HANDLER__WEBPACK_IMPORTED_MODULE_0___default()(`UPDATE users SET password='${hashedPassword}' WHERE email='${email}'`);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
res.json({
success: updatePassword?.affectedRows ? true : false
});
} else {
return res.json({
msg: "UNauthorized"
});
}
}
/***/ })
};
;
// load runtime
var __webpack_require__ = require("../../webpack-api-runtime.js");
__webpack_require__.C(exports);
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
var __webpack_exports__ = __webpack_require__.X(0, [2224], () => (__webpack_exec__(2434)));
module.exports = __webpack_exports__;
})();