Skip to content

Commit

Permalink
NAS-132661: Move 2FA text (#11295)
Browse files Browse the repository at this point in the history
  • Loading branch information
undsoft authored Jan 7, 2025
1 parent 7ab0907 commit 247cab3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
4 changes: 4 additions & 0 deletions src/app/pages/signin/signin-form/signin-form.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
}
}
@if (hasTwoFactor) {
<p>
{{ '2FA has been configured for this account. Enter the OTP to continue.' | translate }}
</p>

<ix-input
formControlName="otp"
autocomplete="one-time-code"
Expand Down
20 changes: 9 additions & 11 deletions src/app/pages/signin/signin-form/signin-form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,17 +138,15 @@ export class SigninFormComponent implements OnInit {
private handleFailedLogin(loginResult: LoginResult): void {
this.isLastLoginAttemptFailed = true;

switch (loginResult) {
case LoginResult.NoAccess:
this.lastLoginError = this.translate.instant('User is lacking permissions to access WebUI.');
break;
case LoginResult.NoOtp:
this.hasTwoFactor = true;
this.lastLoginError = this.translate.instant('2FA has been configured for this account. Enter the OTP to continue.');
break;
default:
this.lastLoginError = this.translate.instant('Wrong username or password. Please try again.');
break;
if (loginResult === LoginResult.NoOtp) {
this.hasTwoFactor = true;
return;
}

if (loginResult === LoginResult.NoAccess) {
this.lastLoginError = this.translate.instant('User is lacking permissions to access WebUI.');
} else {
this.lastLoginError = this.translate.instant('Wrong username or password. Please try again.');
}

this.cdr.markForCheck();
Expand Down

0 comments on commit 247cab3

Please sign in to comment.