This commit is contained in:
Tben 2023-05-06 14:15:22 +01:00
parent 224dbf4175
commit 7e83ab8d0e
3 changed files with 78 additions and 65 deletions

View File

@ -1,6 +1,6 @@
{
"name": "datasquirel",
"version": "1.0.6",
"version": "1.0.8",
"description": "Cloud-based SQL data management tool",
"main": "index.js",
"scripts": {

View File

@ -131,7 +131,7 @@ module.exports = async function ({ key, payload, database, response, encryptionK
encryptionSalt,
});
response.setHeader("Set-Cookie", [`datasquirelAuthKey=${encryptedPayload};samesite=strict;path=/;HttpOnly=true;Secure=true`, `csrf=${httpResponse.csrf};samesite=strict;path=/;HttpOnly=true`]);
response.setHeader("Set-Cookie", [`datasquirelAuthKey=${encryptedPayload};samesite=strict;path=/;HttpOnly=true;Secure=true`, `csrf=${httpResponse.payload.csrf};samesite=strict;path=/;HttpOnly=true`]);
}
/** ********************************************** */

View File

@ -21,6 +21,7 @@ const decrypt = require("../functions/decrypt");
* @param {String} encryptionSalt - Encryption Salt
*/
module.exports = function ({ request, encryptionKey, encryptionSalt }) {
try {
/**
* Grab the payload
*
@ -90,6 +91,18 @@ module.exports = function ({ request, encryptionKey, encryptionSalt }) {
success: true,
payload: userObject,
};
} catch (error) {
/**
* Return User Object
*
* @description Return User Object
*/
return {
success: false,
payload: null,
msg: error.message,
};
}
};
/** ********************************************** */