37 lines
1.4 KiB
JavaScript
37 lines
1.4 KiB
JavaScript
|
"use strict";
|
||
|
exports.id = 1503;
|
||
|
exports.ids = [1503];
|
||
|
exports.modules = {
|
||
|
|
||
|
/***/ 1503:
|
||
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
||
|
|
||
|
// @ts-check
|
||
|
|
||
|
const { IncomingMessage } = __webpack_require__(3685);
|
||
|
const decrypt = __webpack_require__(5304);
|
||
|
/**
|
||
|
* @async
|
||
|
* @param {import("next").NextApiRequest | IncomingMessage & { cookies: Partial<{ [key: string]: string; }>} } req - https request object
|
||
|
*
|
||
|
* @returns {Promise<({ email: string, password: string, authKey: string, logged_in_status: boolean, date: number } | null)>}
|
||
|
*/ module.exports = async function(req) {
|
||
|
/** ********************* Check for existence of required cookie */ if (!req.cookies?.datasquirelSuAdminUserAuthKey) {
|
||
|
return null;
|
||
|
}
|
||
|
/** ********************* Grab the payload */ let userPayload = decrypt(req.cookies.datasquirelSuAdminUserAuthKey);
|
||
|
/** ********************* Return if no payload */ if (!userPayload) return null;
|
||
|
/** ********************* Parse the payload */ let userObject = JSON.parse(userPayload);
|
||
|
if (userObject.password !== process.env.DSQL_USER_KEY) return null;
|
||
|
if (userObject.authKey !== process.env.DSQL_SPECIAL_KEY) return null;
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
////////////////////////////////////////
|
||
|
/** ********************* return user object */ return userObject;
|
||
|
};
|
||
|
|
||
|
|
||
|
/***/ })
|
||
|
|
||
|
};
|
||
|
;
|