diff --git a/ui-ngx/src/app/modules/home/pages/admin/two-factor-auth-settings.component.html b/ui-ngx/src/app/modules/home/pages/admin/two-factor-auth-settings.component.html index f3e850a8d7..8aff328999 100644 --- a/ui-ngx/src/app/modules/home/pages/admin/two-factor-auth-settings.component.html +++ b/ui-ngx/src/app/modules/home/pages/admin/two-factor-auth-settings.component.html @@ -33,7 +33,7 @@
admin.2fa.verification-limitations -
+
admin.2fa.total-allowed-time-for-verification @@ -58,62 +58,137 @@
- - {{ 'admin.2fa.verification-code-send-rate-limit' | translate }} - -
- - admin.2fa.number-of-send-attempts - - - {{ 'admin.2fa.number-of-send-attempts-required' | translate }} - - + + + + + {{ 'admin.2fa.verification-code-send-rate-limit' | translate }} + + + +
+ + admin.2fa.number-of-send-attempts + + + {{ 'admin.2fa.number-of-send-attempts-required' | translate }} + + - {{ 'admin.2fa.number-of-send-attempts-pattern' | translate }} - - - - admin.2fa.within-time - - - {{ 'admin.2fa.within-time-required' | translate }} - - + admin.2fa.within-time + + + {{ 'admin.2fa.within-time-required' | translate }} + + - {{ 'admin.2fa.within-time-pattern' | translate }} - - -
- - {{ 'admin.2fa.verification-code-check-rate-limit' | translate }} - -
- - admin.2fa.number-of-checking-attempts - - - {{ 'admin.2fa.number-of-checking-attempts-required' | translate }} - - --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ 'admin.2fa.verification-code-check-rate-limit' | translate }} + + + +
+ + admin.2fa.number-of-checking-attempts + + + {{ 'admin.2fa.number-of-checking-attempts-required' | translate }} + + - {{ 'admin.2fa.number-of-checking-attempts-pattern' | translate }} - - - - admin.2fa.within-time - - - {{ 'admin.2fa.within-time-required' | translate }} - - + admin.2fa.within-time + + + {{ 'admin.2fa.within-time-required' | translate }} + + - {{ 'admin.2fa.within-time-pattern' | translate }} - - -
+ {{ 'admin.2fa.within-time-pattern' | translate }} +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
admin.2fa.available-providers diff --git a/ui-ngx/src/app/modules/home/pages/admin/two-factor-auth-settings.component.scss b/ui-ngx/src/app/modules/home/pages/admin/two-factor-auth-settings.component.scss index 2ae3981717..6a716e6c47 100644 --- a/ui-ngx/src/app/modules/home/pages/admin/two-factor-auth-settings.component.scss +++ b/ui-ngx/src/app/modules/home/pages/admin/two-factor-auth-settings.component.scss @@ -26,17 +26,15 @@ legend { color: rgba(0, 0, 0, .7); width: fit-content; + margin: 0 8px; } - &:not(:last-of-type) { - padding: 8px; + .input-row { + padding: 8px 8px 0; } &:last-of-type { margin-bottom: 24px; - legend { - margin: 0 8px; - } } .rate-limit-toggle { diff --git a/ui-ngx/src/app/modules/home/pages/admin/two-factor-auth-settings.component.ts b/ui-ngx/src/app/modules/home/pages/admin/two-factor-auth-settings.component.ts index c866612049..10cc499118 100644 --- a/ui-ngx/src/app/modules/home/pages/admin/two-factor-auth-settings.component.ts +++ b/ui-ngx/src/app/modules/home/pages/admin/two-factor-auth-settings.component.ts @@ -92,10 +92,14 @@ export class TwoFactorAuthSettingsComponent extends PageComponent implements OnI } toggleProviders($event: Event, i: number): void { + this.toggleExtensionPanel($event, i + 2, this.providersForm.at(i).get('enable').value); + } + + toggleExtensionPanel($event: Event, i: number, currentState: boolean) { if ($event) { $event.stopPropagation(); } - if (this.providersForm.at(i).get('enable').value) { + if (currentState) { this.getByIndexPanel(i).close(); } else { this.getByIndexPanel(i).open(); @@ -175,7 +179,7 @@ export class TwoFactorAuthSettingsComponent extends PageComponent implements OnI const findIndex = allowProvidersConfig.indexOf(provider); if (findIndex > -1) { processFormValue.providers.push(Object.assign(settings.providers[findIndex], {enable: true})); - this.getByIndexPanel(index).open(); + this.getByIndexPanel(index + 2).open(); } else { processFormValue.providers.push({enable: false}); } diff --git a/ui-ngx/src/app/modules/login/pages/login/two-factor-auth-login.component.scss b/ui-ngx/src/app/modules/login/pages/login/two-factor-auth-login.component.scss index 7403d7a27c..c29e4ae6d4 100644 --- a/ui-ngx/src/app/modules/login/pages/login/two-factor-auth-login.component.scss +++ b/ui-ngx/src/app/modules/login/pages/login/two-factor-auth-login.component.scss @@ -28,7 +28,7 @@ } .mat-card-title{ - font: 500 28px / 36px Roboto, "Helvetica Neue", sans-serif; + font: 400 28px / 36px Roboto, "Helvetica Neue", sans-serif; } .mat-card-content { @@ -58,9 +58,15 @@ ::ng-deep{ button.provider { text-align: start; + font-weight: 400; &:not(.mat-button-disabled) { border-color: rgba(255, 255, 255, .8); } + .icon{ + height: 18px; + width: 18px; + vertical-align: sub; + } } } } diff --git a/ui-ngx/src/app/modules/login/pages/login/two-factor-auth-login.component.ts b/ui-ngx/src/app/modules/login/pages/login/two-factor-auth-login.component.ts index c2d34856e6..0c47899651 100644 --- a/ui-ngx/src/app/modules/login/pages/login/two-factor-auth-login.component.ts +++ b/ui-ngx/src/app/modules/login/pages/login/two-factor-auth-login.component.ts @@ -36,6 +36,7 @@ import { TranslateService } from '@ngx-translate/core'; export class TwoFactorAuthLoginComponent extends PageComponent implements OnInit { private providersInfo: TwoFaProviderInfo[]; + private prevProvider: TwoFactorAuthProviderType; selectedProvider: TwoFactorAuthProviderType; twoFactorAuthProvider = TwoFactorAuthProviderType; @@ -89,13 +90,16 @@ export class TwoFactorAuthLoginComponent extends PageComponent implements OnInit } selectProvider(type: TwoFactorAuthProviderType) { + this.prevProvider = type === null ? this.selectedProvider : null; this.selectedProvider = type; - const providerConfig = this.providersInfo.find(config => config.type === type); - this.providerDescription = this.translate.instant(this.providersData.get(providerConfig.type).description, { - contact: providerConfig.contact - }); - if (type !== TwoFactorAuthProviderType.TOTP && type !== null) { - this.sendCode(); + if (type !== null) { + const providerConfig = this.providersInfo.find(config => config.type === type); + this.providerDescription = this.translate.instant(this.providersData.get(providerConfig.type).description, { + contact: providerConfig.contact + }); + if (type !== TwoFactorAuthProviderType.TOTP) { + this.sendCode(); + } } } @@ -104,6 +108,11 @@ export class TwoFactorAuthLoginComponent extends PageComponent implements OnInit } cancelLogin() { - this.authService.logout(); + if (this.prevProvider) { + this.selectedProvider = this.prevProvider; + this.prevProvider = null; + } else { + this.authService.logout(); + } } }