updates
This commit is contained in:
parent
0f2ae76bbc
commit
c4c355f58c
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "datasquirel",
|
"name": "datasquirel",
|
||||||
"version": "1.1.53",
|
"version": "1.1.54",
|
||||||
"description": "Cloud-based SQL data management tool",
|
"description": "Cloud-based SQL data management tool",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -6,7 +6,9 @@ const parseCookies = require("../utils/functions/parseCookies");
|
|||||||
* @param {object} params - Single Param object containing params
|
* @param {object} params - Single Param object containing params
|
||||||
* @param {object} params.request - Http request object
|
* @param {object} params.request - Http request object
|
||||||
* @param {object} params.response - Http response object
|
* @param {object} params.response - Http response object
|
||||||
* @param {string} params.database - Target database name(slug)
|
* @param {string} [params.database] - Target database name(slug): optional => If you don't
|
||||||
|
* include this you will be logged out of all datasquirel websites instead of just the target
|
||||||
|
* database
|
||||||
*
|
*
|
||||||
* @returns {{success: boolean, payload: string}}
|
* @returns {{success: boolean, payload: string}}
|
||||||
*/
|
*/
|
||||||
@ -27,7 +29,14 @@ module.exports = function ({ request, response, database }) {
|
|||||||
const authKeyName = cookiesKeys.filter((cookieKey) => cookieKey.match(keyRegexp))[0];
|
const authKeyName = cookiesKeys.filter((cookieKey) => cookieKey.match(keyRegexp))[0];
|
||||||
const csrfName = cookiesKeys.filter((cookieKey) => cookieKey.match(csrfRegexp))[0];
|
const csrfName = cookiesKeys.filter((cookieKey) => cookieKey.match(csrfRegexp))[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`]);
|
if (authKeyName && csrfName) {
|
||||||
|
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`]);
|
||||||
|
} else {
|
||||||
|
const allKeys = cookiesKeys.filter((cookieKey) => cookieKey.match(/datasquirel_.*_auth_key/));
|
||||||
|
const allCsrfs = cookiesKeys.filter((cookieKey) => cookieKey.match(/datasquirel_.*_csrf/));
|
||||||
|
|
||||||
|
response.setHeader("Set-Cookie", [...allKeys.map((key) => `${key}=null;samesite=strict;path=/;HttpOnly=true;Secure=true`), ...allCsrfs.map((csrf) => `${csrf}=null;samesite=strict;path=/;HttpOnly=true`), `dsqluid=null;samesite=strict;path=/;HttpOnly=true`]);
|
||||||
|
}
|
||||||
|
|
||||||
/** ********************************************** */
|
/** ********************************************** */
|
||||||
/** ********************************************** */
|
/** ********************************************** */
|
||||||
|
Loading…
Reference in New Issue
Block a user