This commit is contained in:
Tben 2023-05-09 15:20:53 +01:00
parent 52628e8eee
commit 1c690339d1
2 changed files with 28 additions and 8 deletions

View File

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

View File

@ -4,13 +4,17 @@
* ==============================================================================
* @param {Object} response - Http response object
*/
module.exports = function ({ response }) {
module.exports = function ({ request, response }) {
/**
* Check Encryption Keys
*
* @description Check Encryption Keys
*/
response.setHeader("Set-Cookie", ["datasquirelAuthKey=null;samesite=strict;path=/;HttpOnly=true;Secure=true", "csrf=null;samesite=strict;path=/;HttpOnly=true"]);
try {
const authKeyName = request.cookies.filter((cookie) => cookie.match(/datasquirel_.*_auth_key/))[0];
const csrfName = request.cookies.filter((cookie) => cookie.match(/datasquirel_.*_csrf/))[0];
response.setHeader("Set-Cookie", [`${authKeyName}=null;samesite=strict;path=/;HttpOnly=true;Secure=true`, `${csrfName}=null;samesite=strict;path=/;HttpOnly=true`, `dsqluid=null;samesite=strict;path=/;HttpOnly=true`]);
/** ********************************************** */
/** ********************************************** */
@ -20,6 +24,22 @@ module.exports = function ({ response }) {
success: true,
payload: "User Logged Out",
};
/** ********************************************** */
/** ********************************************** */
/** ********************************************** */
} catch (error) {
console.log(error.message);
return {
success: false,
payload: "Logout Failed",
};
}
/** ********************************************** */
/** ********************************************** */
/** ********************************************** */
};
/** ********************************************** */