From 9dbaca5ebe229bcc831bb9ac40c51d789de813c4 Mon Sep 17 00:00:00 2001 From: Benjamin Toby Date: Fri, 20 Dec 2024 08:36:44 +0100 Subject: [PATCH] Updates --- package-shared/functions/backend/updateUsersTableSchema.js | 4 ++-- package.json | 2 +- users/login-user.d.ts | 4 +++- users/login-user.js | 4 +++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/package-shared/functions/backend/updateUsersTableSchema.js b/package-shared/functions/backend/updateUsersTableSchema.js index ef8f13d..c83230b 100755 --- a/package-shared/functions/backend/updateUsersTableSchema.js +++ b/package-shared/functions/backend/updateUsersTableSchema.js @@ -1,8 +1,8 @@ // @ts-check const serverError = require("./serverError"); -const { default: grabUserSchemaData } = require("./grabUserSchemaData"); -const { default: setUserSchemaData } = require("./setUserSchemaData"); +const grabUserSchemaData = require("./grabUserSchemaData"); +const setUserSchemaData = require("./setUserSchemaData"); const createDbFromSchema = require("../../shell/createDbFromSchema"); const grabSchemaFieldsFromData = require("./grabSchemaFieldsFromData"); diff --git a/package.json b/package.json index a438fc2..f26f58c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@moduletrace/datasquirel", - "version": "3.1.8", + "version": "3.1.9", "description": "Cloud-based SQL data management tool", "main": "index.js", "bin": { diff --git a/users/login-user.d.ts b/users/login-user.d.ts index 2e677ce..319ed15 100644 --- a/users/login-user.d.ts +++ b/users/login-user.d.ts @@ -23,11 +23,12 @@ export = loginUser; * @param {string | number} [params.user_id] - User ID * @param {boolean} [params.skipPassword] * @param {boolean} [params.useLocal] + * @param {boolean} [params.skipWriteAuthFile] - Skip writing auth file to `.tmp/login` folder * @param {string | number} [params.apiUserID] - Required for setting of cookies * * @returns { Promise} */ -declare function loginUser({ key, payload, database, additionalFields, response, encryptionKey, encryptionSalt, email_login, email_login_code, temp_code_field, token, user_id, skipPassword, useLocal, apiUserID, }: { +declare function loginUser({ key, payload, database, additionalFields, response, encryptionKey, encryptionSalt, email_login, email_login_code, temp_code_field, token, user_id, skipPassword, useLocal, apiUserID, skipWriteAuthFile, }: { key?: string; database: string; payload: { @@ -48,6 +49,7 @@ declare function loginUser({ key, payload, database, additionalFields, response, user_id?: string | number; skipPassword?: boolean; useLocal?: boolean; + skipWriteAuthFile?: boolean; apiUserID?: string | number; }): Promise; import http = require("http"); diff --git a/users/login-user.js b/users/login-user.js index c116cf0..226476f 100644 --- a/users/login-user.js +++ b/users/login-user.js @@ -41,6 +41,7 @@ const { * @param {string | number} [params.user_id] - User ID * @param {boolean} [params.skipPassword] * @param {boolean} [params.useLocal] + * @param {boolean} [params.skipWriteAuthFile] - Skip writing auth file to `.tmp/login` folder * @param {string | number} [params.apiUserID] - Required for setting of cookies * * @returns { Promise} @@ -61,6 +62,7 @@ async function loginUser({ skipPassword, useLocal, apiUserID, + skipWriteAuthFile, }) { const grabedHostNames = grabHostNames(); const { host, port, scheme } = grabedHostNames; @@ -247,7 +249,7 @@ async function loginUser({ userId: apiUserID || user_id || grabedHostNames.user_id, }); - if (httpResponse.csrf) { + if (httpResponse.csrf && !skipWriteAuthFile) { writeAuthFile( httpResponse.csrf, JSON.stringify(httpResponse.payload)