Browse Source

UI: Refactoring

pull/9791/head
Artem Dzhereleiko 3 years ago
parent
commit
793639a877
  1. 9
      ui-ngx/src/app/modules/home/pages/admin/security-settings.component.html
  2. 6
      ui-ngx/src/app/modules/home/pages/admin/security-settings.component.scss
  3. 7
      ui-ngx/src/app/modules/home/pages/admin/security-settings.component.ts
  4. 3
      ui-ngx/src/app/modules/login/pages/login/login.component.html
  5. 4
      ui-ngx/src/app/modules/login/pages/login/login.component.ts
  6. 3
      ui-ngx/src/app/shared/models/constants.ts
  7. 1
      ui-ngx/src/assets/locale/locale.constant-en_US.json

9
ui-ngx/src/app/modules/home/pages/admin/security-settings.component.html

@ -157,7 +157,14 @@
<mat-label translate>admin.allow-whitespace</mat-label>
</mat-checkbox>
<mat-checkbox fxFlex formControlName="forceUserToResetPasswordIfNotValid" style="margin-bottom: 16px">
<mat-label translate>admin.force-reset-password-if-no-valid</mat-label>
<mat-label>
{{'admin.force-reset-password-if-no-valid' | translate}}
<mat-icon
class="hint-icon"
matTooltip="{{'admin.force-reset-password-if-no-valid-hint' | translate}}"
svgIcon="mdi:information-outline">
</mat-icon>
</mat-label>
</mat-checkbox>
</div>
</section>

6
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;
}
}

7
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;
}

3
ui-ngx/src/app/modules/login/pages/login/login.component.html

@ -56,7 +56,8 @@
<mat-icon matPrefix>lock</mat-icon>
</mat-form-field>
<div fxLayoutAlign="end center" class="forgot-password">
<button class="tb-reset-password" mat-button type="button" routerLink="/login/resetPasswordRequest">{{ 'login.forgot-password' | translate }}
<button class="tb-reset-password" mat-button type="button" routerLink="/login/resetPasswordRequest">
{{ (passwordViolation ? 'login.reset-password' : 'login.forgot-password') | translate }}
</button>
</div>
<div fxLayout="column" class="tb-action-button">

4
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;
}
}
}

3
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',

1
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",

Loading…
Cancel
Save