From af226ab16036dd6e4d6ea473bac516f60f840e47 Mon Sep 17 00:00:00 2001 From: MillenniumEarl Date: Thu, 11 Mar 2021 14:36:08 +0100 Subject: [PATCH] Use LoginResult code instead of message --- src/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 6531359..a73faf4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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; }