minor revision
This commit is contained in:
parent
ab6a09558c
commit
ca8a0b0867
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "datasquirel",
|
"name": "datasquirel",
|
||||||
"version": "1.1.83",
|
"version": "1.1.84",
|
||||||
"description": "Cloud-based SQL data management tool",
|
"description": "Cloud-based SQL data management tool",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -19,22 +19,23 @@ const https = require("https");
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ==============================================================================
|
* @typedef {object} UserDataPayload
|
||||||
* Main Function
|
* @property {!string} first_name - First Name *Required
|
||||||
|
* @property {!string} last_name - Last Name *Required
|
||||||
|
* @property {!string} email - Email *Required
|
||||||
|
* @property {!string} password - Password *Required
|
||||||
|
* @property {string?} username - Username (Optional)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add User to Database
|
||||||
* ==============================================================================
|
* ==============================================================================
|
||||||
* @async
|
* @async
|
||||||
*
|
*
|
||||||
* @param {{
|
* @param {object} props - Single object passed
|
||||||
* key: string,
|
* @param {string} props.key - FULL ACCESS API Key
|
||||||
* database: string
|
* @param {string} props.database - Database Name
|
||||||
* payload: {
|
* @param {UserDataPayload} props.payload - User Data Payload
|
||||||
* first_name: string,
|
|
||||||
* last_name: string,
|
|
||||||
* username: string,
|
|
||||||
* email: string,
|
|
||||||
* password: string,
|
|
||||||
* },
|
|
||||||
* }}
|
|
||||||
*
|
*
|
||||||
* @returns { Promise<FunctionReturn> }
|
* @returns { Promise<FunctionReturn> }
|
||||||
*/
|
*/
|
||||||
|
@ -14,7 +14,7 @@ const encrypt = require("../functions/encrypt");
|
|||||||
/** ****************************************************************************** */
|
/** ****************************************************************************** */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {object} FunctionReturn
|
* @typedef {object} AuthenticatedUser
|
||||||
* @property {boolean} success - Did the function run successfully?
|
* @property {boolean} success - Did the function run successfully?
|
||||||
* @property {{
|
* @property {{
|
||||||
* id: number,
|
* id: number,
|
||||||
@ -37,13 +37,12 @@ const encrypt = require("../functions/encrypt");
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ==============================================================================
|
* Login A user
|
||||||
* Main Function
|
|
||||||
* ==============================================================================
|
* ==============================================================================
|
||||||
* @async
|
* @async
|
||||||
*
|
*
|
||||||
* @param {object} params - Single Param object containing params
|
* @param {object} params - Single Param object containing params
|
||||||
* @param {String} params.key - API Key
|
* @param {String} params.key - FULL ACCESS API Key
|
||||||
* @param {String} params.database - Target Database
|
* @param {String} params.database - Target Database
|
||||||
* @param {{
|
* @param {{
|
||||||
* email: string,
|
* email: string,
|
||||||
@ -53,7 +52,7 @@ const encrypt = require("../functions/encrypt");
|
|||||||
* @param {String} params.encryptionKey - Encryption Key
|
* @param {String} params.encryptionKey - Encryption Key
|
||||||
* @param {String} params.encryptionSalt - Encryption Salt
|
* @param {String} params.encryptionSalt - Encryption Salt
|
||||||
*
|
*
|
||||||
* @returns { Promise<FunctionReturn>}
|
* @returns { Promise<AuthenticatedUser>}
|
||||||
*/
|
*/
|
||||||
async function loginUser({ key, payload, database, response, encryptionKey, encryptionSalt }) {
|
async function loginUser({ key, payload, database, response, encryptionKey, encryptionSalt }) {
|
||||||
/**
|
/**
|
||||||
|
@ -29,6 +29,8 @@ function logoutUser({ 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];
|
||||||
|
|
||||||
|
console.log(authKeyName, csrfName);
|
||||||
|
|
||||||
if (authKeyName && csrfName) {
|
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`]);
|
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 {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user