Update login user function

This commit is contained in:
Benjamin Toby 2024-08-15 16:17:39 +01:00
parent e3bbc2c2e3
commit 607552d451

View File

@ -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<AuthenticatedUser>}
*/
@ -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`;