Use LoginResult code instead of message

pull/81/head
MillenniumEarl 2021-03-11 14:36:08 +01:00
parent 9f1b241fb5
commit af226ab160
1 changed files with 2 additions and 1 deletions

View File

@ -106,7 +106,7 @@ export async function login(
shared.setIsLogged(result.success);
// 2FA Authentication is required, fetch OTP
if (result.message === "Two-factor authentication is needed to continue") {
if (result.code === LoginResult.REQUIRE_2FA) {
const code = await cb2fa();
const response2fa = await send2faCode(code, creds.token);
if (response2fa.isSuccess()) result = response2fa.value;
@ -124,6 +124,7 @@ export async function login(
shared.logger.info("User logged in through the platform");
} else shared.logger.warn(`Error during authentication: ${result.message}`);
shared.setIsLogged(result.success);
return result;
}