From 607552d451dd18d0df37764bdfa2973ceb3aa38d Mon Sep 17 00:00:00 2001 From: Benjamin Toby Date: Thu, 15 Aug 2024 16:17:39 +0100 Subject: [PATCH] Update login user function --- users/login-user.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/users/login-user.js b/users/login-user.js index a7ee641..63f753b 100644 --- a/users/login-user.js +++ b/users/login-user.js @@ -47,6 +47,7 @@ const loginLocalUser = require("../engine/user/login-user"); * @param {boolean} [params.email_login] - Email only Login * @param {string} [params.email_login_code] - Email login code * @param {string} [params.temp_code_field] - Database table field name for temporary code + * @param {boolean} [params.token] - Send access key as part of response body? * * @returns { Promise} */ @@ -61,6 +62,7 @@ async function loginUser({ email_login, email_login_code, temp_code_field, + token, }) { const scheme = process.env.DSQL_HTTP_SCHEME; const localHost = process.env.DSQL_LOCAL_HOST; @@ -229,6 +231,10 @@ async function loginUser({ encryptionSalt, }); + try { + if (token) httpResponse["token"] = encryptedPayload; + } catch (error) {} + const { userId } = httpResponse; const authKeyName = `datasquirel_${userId}_${database}_auth_key`;