Skip to content

Commit

Permalink
Fix MFA process
Browse files Browse the repository at this point in the history
Hotfix for MFA process issue
  • Loading branch information
haimkastner authored Sep 26, 2021
2 parents f13e74e + 01c4ad7 commit 7e55131
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions backend/src/controllers/authController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,13 @@ export class AuthController extends Controller {
}

if (loginResults.error) {
/** Mark status to 201, means, the login is OK but needs extra, MFA. */
this.setStatus(501);
return;
this.setStatus(403);
return loginResults?.error?.responseCode && { responseCode: loginResults.error.responseCode} as unknown as void;
}

} catch (error) {
this.setStatus(403);
return;
return error?.responseCode && { responseCode: error.responseCode} as unknown as void;;
}
this.setStatus(501);
return;
Expand All @@ -103,21 +102,20 @@ export class AuthController extends Controller {
try {
const loginResults = await AuthBlSingleton.loginTfa(loginData);

if (loginResults.success && loginResults.requireMfa) {
if (loginResults.success) {
this.activeSession(loginResults.key);
this.setStatus(200);
return;
}

if (loginResults.error) {
/** Mark status to 201, means, the login is OK but needs extra, MFA. */
this.setStatus(501);
return;
this.setStatus(403);
return loginResults?.error?.responseCode && { responseCode: loginResults.error.responseCode} as unknown as void;
}

} catch (error) {
this.setStatus(403);
return;
return (error?.responseCode && { responseCode: error.responseCode }) as unknown as void;
}
this.setStatus(501);
return;
Expand Down

0 comments on commit 7e55131

Please sign in to comment.