minor revision
This commit is contained in:
parent
ab6a09558c
commit
ca8a0b0867
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "datasquirel",
|
||||
"version": "1.1.83",
|
||||
"version": "1.1.84",
|
||||
"description": "Cloud-based SQL data management tool",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
@ -19,22 +19,23 @@ const https = require("https");
|
||||
*/
|
||||
|
||||
/**
|
||||
* ==============================================================================
|
||||
* Main Function
|
||||
* @typedef {object} UserDataPayload
|
||||
* @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
|
||||
*
|
||||
* @param {{
|
||||
* key: string,
|
||||
* database: string
|
||||
* payload: {
|
||||
* first_name: string,
|
||||
* last_name: string,
|
||||
* username: string,
|
||||
* email: string,
|
||||
* password: string,
|
||||
* },
|
||||
* }}
|
||||
* @param {object} props - Single object passed
|
||||
* @param {string} props.key - FULL ACCESS API Key
|
||||
* @param {string} props.database - Database Name
|
||||
* @param {UserDataPayload} props.payload - User Data Payload
|
||||
*
|
||||
* @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 {{
|
||||
* id: number,
|
||||
@ -37,13 +37,12 @@ const encrypt = require("../functions/encrypt");
|
||||
*/
|
||||
|
||||
/**
|
||||
* ==============================================================================
|
||||
* Main Function
|
||||
* Login A user
|
||||
* ==============================================================================
|
||||
* @async
|
||||
*
|
||||
* @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 {{
|
||||
* email: string,
|
||||
@ -53,7 +52,7 @@ const encrypt = require("../functions/encrypt");
|
||||
* @param {String} params.encryptionKey - Encryption Key
|
||||
* @param {String} params.encryptionSalt - Encryption Salt
|
||||
*
|
||||
* @returns { Promise<FunctionReturn>}
|
||||
* @returns { Promise<AuthenticatedUser>}
|
||||
*/
|
||||
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 csrfName = cookiesKeys.filter((cookieKey) => cookieKey.match(csrfRegexp))[0];
|
||||
|
||||
console.log(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`]);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user