From ad16e42a6c88e69893df7827841a41e01758e625 Mon Sep 17 00:00:00 2001 From: Benjamin Toby Date: Wed, 11 Dec 2024 05:24:58 +0100 Subject: [PATCH] Bugfix --- package-shared/functions/api/users/api-login.js | 4 ++-- package.json | 2 +- users/get-user.d.ts | 8 ++++---- users/get-user.js | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package-shared/functions/api/users/api-login.js b/package-shared/functions/api/users/api-login.js index 87f0603..6a7f28a 100644 --- a/package-shared/functions/api/users/api-login.js +++ b/package-shared/functions/api/users/api-login.js @@ -103,8 +103,8 @@ module.exports = async function apiLoginUser({ if (isPasswordCorrect && email_login) { const resetTempCode = await varDatabaseDbHandler({ - queryString: `UPDATE users SET ${email_login_field} = ? WHERE email = ? OR username = ?`, - queryValuesArray: ["", email, username], + queryString: `UPDATE users SET ${email_login_field} = '' WHERE email = ? OR username = ?`, + queryValuesArray: [email, username], database: dbFullName.replace(/[^a-z0-9_]/g, ""), useLocal, }); diff --git a/package.json b/package.json index 8f55a73..dd66bdf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@moduletrace/datasquirel", - "version": "2.9.5", + "version": "2.9.6", "description": "Cloud-based SQL data management tool", "main": "index.js", "bin": { diff --git a/users/get-user.d.ts b/users/get-user.d.ts index 63e4479..29a7b57 100644 --- a/users/get-user.d.ts +++ b/users/get-user.d.ts @@ -14,18 +14,18 @@ export = getUser; * @param {object} params - Single Param object containing params * @param {String} params.key - API Key * @param {String} params.database - Target Database - * @param {number} params.userId - user id + * @param {number} params.userId - user to get * @param {string[]} [params.fields] - fields to select - * @param {boolean} [params.user_id] - User ID + * @param {boolean} [params.apiUserId] - API User ID * @param {boolean} [params.useLocal] - Whether to use a remote database instead of API * * @returns { Promise} */ -declare function getUser({ key, userId, database, fields, user_id, useLocal }: { +declare function getUser({ key, userId, database, fields, apiUserId, useLocal }: { key: string; database: string; userId: number; fields?: string[]; - user_id?: boolean; + apiUserId?: boolean; useLocal?: boolean; }): Promise; diff --git a/users/get-user.js b/users/get-user.js index 032893a..a430f51 100644 --- a/users/get-user.js +++ b/users/get-user.js @@ -28,14 +28,14 @@ const apiGetUser = require("../package-shared/functions/api/users/api-get-user") * @param {object} params - Single Param object containing params * @param {String} params.key - API Key * @param {String} params.database - Target Database - * @param {number} params.userId - user id + * @param {number} params.userId - user to get * @param {string[]} [params.fields] - fields to select - * @param {boolean} [params.user_id] - User ID + * @param {boolean} [params.apiUserId] - API User ID * @param {boolean} [params.useLocal] - Whether to use a remote database instead of API * * @returns { Promise} */ -async function getUser({ key, userId, database, fields, user_id, useLocal }) { +async function getUser({ key, userId, database, fields, apiUserId, useLocal }) { /** * Initialize */ @@ -122,7 +122,7 @@ async function getUser({ key, userId, database, fields, user_id, useLocal }) { port, hostname: host, path: `/api/user/${ - user_id || grabedHostNames.user_id + apiUserId || grabedHostNames.user_id }/get-user`, },