From 793639a87798203499f5cdc68da70cf9f66cd3a7 Mon Sep 17 00:00:00 2001 From: Artem Dzhereleiko Date: Fri, 8 Dec 2023 15:09:36 +0200 Subject: [PATCH] UI: Refactoring --- .../home/pages/admin/security-settings.component.html | 9 ++++++++- .../home/pages/admin/security-settings.component.scss | 6 ++++++ .../home/pages/admin/security-settings.component.ts | 7 ++++++- .../app/modules/login/pages/login/login.component.html | 3 ++- .../src/app/modules/login/pages/login/login.component.ts | 4 ++++ ui-ngx/src/app/shared/models/constants.ts | 3 ++- ui-ngx/src/assets/locale/locale.constant-en_US.json | 1 + 7 files changed, 29 insertions(+), 4 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/admin/security-settings.component.html b/ui-ngx/src/app/modules/home/pages/admin/security-settings.component.html index f49b2b25e8..189d75d56d 100644 --- a/ui-ngx/src/app/modules/home/pages/admin/security-settings.component.html +++ b/ui-ngx/src/app/modules/home/pages/admin/security-settings.component.html @@ -157,7 +157,14 @@ admin.allow-whitespace - admin.force-reset-password-if-no-valid + + {{'admin.force-reset-password-if-no-valid' | translate}} + + + diff --git a/ui-ngx/src/app/modules/home/pages/admin/security-settings.component.scss b/ui-ngx/src/app/modules/home/pages/admin/security-settings.component.scss index d9300a5504..fcafcb9c95 100644 --- a/ui-ngx/src/app/modules/home/pages/admin/security-settings.component.scss +++ b/ui-ngx/src/app/modules/home/pages/admin/security-settings.component.scss @@ -32,4 +32,10 @@ color: rgba(0, 0, 0, .7); } } + + .hint-icon { + width: 15px; + height: 15px; + vertical-align: top; + } } diff --git a/ui-ngx/src/app/modules/home/pages/admin/security-settings.component.ts b/ui-ngx/src/app/modules/home/pages/admin/security-settings.component.ts index 5c64d78049..4ca662763a 100644 --- a/ui-ngx/src/app/modules/home/pages/admin/security-settings.component.ts +++ b/ui-ngx/src/app/modules/home/pages/admin/security-settings.component.ts @@ -35,7 +35,10 @@ import { randomAlphanumeric } from '@core/utils'; import { AuthService } from '@core/auth/auth.service'; import { DialogService } from '@core/services/dialog.service'; import { TranslateService } from '@ngx-translate/core'; -import { Observable, of } from 'rxjs'; +import { forkJoin, Observable, of } from 'rxjs'; +import { MatCheckboxChange } from '@angular/material/checkbox'; +import { AlarmInfo } from '@shared/models/alarm.models'; +import { QueueProcessingStrategyTypes, QueueProcessingStrategyTypesMap } from '@shared/models/queue.models'; @Component({ selector: 'tb-security-settings', @@ -211,4 +214,6 @@ export class SecuritySettingsComponent extends PageComponent implements HasConfi return this.securitySettingsFormGroup.dirty ? this.securitySettingsFormGroup : this.jwtSecuritySettingsFormGroup; } + protected readonly queueProcessingStrategyTypes = QueueProcessingStrategyTypes; + protected readonly queueProcessingStrategyTypesMap = QueueProcessingStrategyTypesMap; } diff --git a/ui-ngx/src/app/modules/login/pages/login/login.component.html b/ui-ngx/src/app/modules/login/pages/login/login.component.html index f5797ae574..8748917ee7 100644 --- a/ui-ngx/src/app/modules/login/pages/login/login.component.html +++ b/ui-ngx/src/app/modules/login/pages/login/login.component.html @@ -56,7 +56,8 @@ lock
-
diff --git a/ui-ngx/src/app/modules/login/pages/login/login.component.ts b/ui-ngx/src/app/modules/login/pages/login/login.component.ts index 2fc1c7c50d..e61322b653 100644 --- a/ui-ngx/src/app/modules/login/pages/login/login.component.ts +++ b/ui-ngx/src/app/modules/login/pages/login/login.component.ts @@ -32,6 +32,8 @@ import { OAuth2ClientInfo } from '@shared/models/oauth2.models'; }) export class LoginComponent extends PageComponent implements OnInit { + passwordViolation = false; + loginFormGroup = this.fb.group({ username: '', password: '' @@ -57,6 +59,8 @@ export class LoginComponent extends PageComponent implements OnInit { if (error && error.error && error.error.errorCode) { if (error.error.errorCode === Constants.serverErrorCode.credentialsExpired) { this.router.navigateByUrl(`login/resetExpiredPassword?resetToken=${error.error.resetToken}`); + } else if (error.error.errorCode === Constants.serverErrorCode.passwordViolation) { + this.passwordViolation = true; } } } diff --git a/ui-ngx/src/app/shared/models/constants.ts b/ui-ngx/src/app/shared/models/constants.ts index 4f904a4bf3..c119ae327f 100644 --- a/ui-ngx/src/app/shared/models/constants.ts +++ b/ui-ngx/src/app/shared/models/constants.ts @@ -30,7 +30,8 @@ export const Constants = { badRequestParams: 31, itemNotFound: 32, tooManyRequests: 33, - tooManyUpdates: 34 + tooManyUpdates: 34, + passwordViolation: 45 }, entryPoints: { login: '/api/auth/login', diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index 8e9433e6d2..93ec444fea 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -200,6 +200,7 @@ "password-reuse-frequency-days-range": "Password reuse frequency in days can't be negative", "allow-whitespace": "Allow whitespace", "force-reset-password-if-no-valid": "Force to reset password if not valid", + "force-reset-password-if-no-valid-hint": "Please, take into it can affect all users with passwords that violate current policy.", "general-policy": "General policy", "max-failed-login-attempts": "Maximum number of failed login attempts, before account is locked", "minimum-max-failed-login-attempts-range": "Maximum number of failed login attempts can't be negative",