This commit is contained in:
Benjamin Toby 2024-12-20 08:36:44 +01:00
parent d627655422
commit 9dbaca5ebe
4 changed files with 9 additions and 5 deletions

View File

@ -1,8 +1,8 @@
// @ts-check // @ts-check
const serverError = require("./serverError"); const serverError = require("./serverError");
const { default: grabUserSchemaData } = require("./grabUserSchemaData"); const grabUserSchemaData = require("./grabUserSchemaData");
const { default: setUserSchemaData } = require("./setUserSchemaData"); const setUserSchemaData = require("./setUserSchemaData");
const createDbFromSchema = require("../../shell/createDbFromSchema"); const createDbFromSchema = require("../../shell/createDbFromSchema");
const grabSchemaFieldsFromData = require("./grabSchemaFieldsFromData"); const grabSchemaFieldsFromData = require("./grabSchemaFieldsFromData");

View File

@ -1,6 +1,6 @@
{ {
"name": "@moduletrace/datasquirel", "name": "@moduletrace/datasquirel",
"version": "3.1.8", "version": "3.1.9",
"description": "Cloud-based SQL data management tool", "description": "Cloud-based SQL data management tool",
"main": "index.js", "main": "index.js",
"bin": { "bin": {

View File

@ -23,11 +23,12 @@ export = loginUser;
* @param {string | number} [params.user_id] - User ID * @param {string | number} [params.user_id] - User ID
* @param {boolean} [params.skipPassword] * @param {boolean} [params.skipPassword]
* @param {boolean} [params.useLocal] * @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 * @param {string | number} [params.apiUserID] - Required for setting of cookies
* *
* @returns { Promise<import("../package-shared/types").APILoginFunctionReturn>} * @returns { Promise<import("../package-shared/types").APILoginFunctionReturn>}
*/ */
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; key?: string;
database: string; database: string;
payload: { payload: {
@ -48,6 +49,7 @@ declare function loginUser({ key, payload, database, additionalFields, response,
user_id?: string | number; user_id?: string | number;
skipPassword?: boolean; skipPassword?: boolean;
useLocal?: boolean; useLocal?: boolean;
skipWriteAuthFile?: boolean;
apiUserID?: string | number; apiUserID?: string | number;
}): Promise<import("../package-shared/types").APILoginFunctionReturn>; }): Promise<import("../package-shared/types").APILoginFunctionReturn>;
import http = require("http"); import http = require("http");

View File

@ -41,6 +41,7 @@ const {
* @param {string | number} [params.user_id] - User ID * @param {string | number} [params.user_id] - User ID
* @param {boolean} [params.skipPassword] * @param {boolean} [params.skipPassword]
* @param {boolean} [params.useLocal] * @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 * @param {string | number} [params.apiUserID] - Required for setting of cookies
* *
* @returns { Promise<import("../package-shared/types").APILoginFunctionReturn>} * @returns { Promise<import("../package-shared/types").APILoginFunctionReturn>}
@ -61,6 +62,7 @@ async function loginUser({
skipPassword, skipPassword,
useLocal, useLocal,
apiUserID, apiUserID,
skipWriteAuthFile,
}) { }) {
const grabedHostNames = grabHostNames(); const grabedHostNames = grabHostNames();
const { host, port, scheme } = grabedHostNames; const { host, port, scheme } = grabedHostNames;
@ -247,7 +249,7 @@ async function loginUser({
userId: apiUserID || user_id || grabedHostNames.user_id, userId: apiUserID || user_id || grabedHostNames.user_id,
}); });
if (httpResponse.csrf) { if (httpResponse.csrf && !skipWriteAuthFile) {
writeAuthFile( writeAuthFile(
httpResponse.csrf, httpResponse.csrf,
JSON.stringify(httpResponse.payload) JSON.stringify(httpResponse.payload)