2019-08-12 19:34:23 +03:00
|
|
|
<!--
|
|
|
|
|
|
2024-01-09 10:46:16 +02:00
|
|
|
Copyright © 2016-2024 The Thingsboard Authors
|
2019-08-12 19:34:23 +03:00
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
|
limitations under the License.
|
|
|
|
|
|
|
|
|
|
-->
|
2023-02-17 19:24:01 +02:00
|
|
|
<mat-card appearance="outlined" class="settings-card">
|
2023-02-20 19:23:26 +02:00
|
|
|
<mat-card-header>
|
|
|
|
|
<mat-card-title>
|
2023-02-17 19:24:01 +02:00
|
|
|
<span class="mat-headline-5" translate>admin.security-settings</span>
|
2023-02-20 19:23:26 +02:00
|
|
|
</mat-card-title>
|
|
|
|
|
<span fxFlex></span>
|
|
|
|
|
<div tb-help="securitySettings"></div>
|
|
|
|
|
</mat-card-header>
|
2022-11-14 11:05:47 +02:00
|
|
|
<mat-progress-bar color="warn" mode="indeterminate" *ngIf="isLoading$ | async">
|
|
|
|
|
</mat-progress-bar>
|
|
|
|
|
<div style="height: 4px;" *ngIf="!(isLoading$ | async)"></div>
|
2023-02-20 19:23:26 +02:00
|
|
|
<mat-card-content>
|
2022-11-14 11:05:47 +02:00
|
|
|
<form [formGroup]="securitySettingsFormGroup" (ngSubmit)="save()" autocomplete="off">
|
|
|
|
|
<fieldset [disabled]="isLoading$ | async">
|
|
|
|
|
<fieldset class="fields-group">
|
|
|
|
|
<legend class="group-title" translate>admin.general-policy</legend>
|
|
|
|
|
<mat-form-field class="mat-block">
|
|
|
|
|
<mat-label translate>admin.max-failed-login-attempts</mat-label>
|
|
|
|
|
<input matInput type="number"
|
|
|
|
|
formControlName="maxFailedLoginAttempts"
|
|
|
|
|
step="1"
|
|
|
|
|
min="0"/>
|
|
|
|
|
<mat-error *ngIf="securitySettingsFormGroup.get('maxFailedLoginAttempts').hasError('min')">
|
|
|
|
|
{{ 'admin.minimum-max-failed-login-attempts-range' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
<mat-form-field class="mat-block">
|
|
|
|
|
<mat-label translate>admin.user-lockout-notification-email</mat-label>
|
|
|
|
|
<input matInput type="email"
|
|
|
|
|
formControlName="userLockoutNotificationEmail"/>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</fieldset>
|
|
|
|
|
|
|
|
|
|
<fieldset class="fields-group">
|
|
|
|
|
<legend class="group-title" translate>admin.password-policy</legend>
|
|
|
|
|
<section formGroupName="passwordPolicy">
|
2023-12-07 12:52:13 +02:00
|
|
|
<div fxLayout="row" fxLayout.xs="column" fxLayoutGap.gt-xs="8px">
|
|
|
|
|
<mat-form-field fxFlex class="mat-block">
|
|
|
|
|
<mat-label translate>admin.minimum-password-length</mat-label>
|
|
|
|
|
<input matInput type="number"
|
|
|
|
|
formControlName="minimumLength"
|
|
|
|
|
step="1"
|
|
|
|
|
min="6"
|
|
|
|
|
max="50"
|
|
|
|
|
required/>
|
|
|
|
|
<mat-error *ngIf="securitySettingsFormGroup.get('passwordPolicy.minimumLength').hasError('required')">
|
|
|
|
|
{{ 'admin.minimum-password-length-required' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
<mat-error *ngIf="securitySettingsFormGroup.get('passwordPolicy.minimumLength').hasError('min')">
|
|
|
|
|
{{ 'admin.minimum-password-length-range' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
<mat-error *ngIf="securitySettingsFormGroup.get('passwordPolicy.minimumLength').hasError('max')">
|
|
|
|
|
{{ 'admin.minimum-password-length-range' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
<mat-form-field fxFlex class="mat-block" subscriptSizing="dynamic">
|
|
|
|
|
<mat-label translate>admin.maximum-password-length</mat-label>
|
|
|
|
|
<input matInput type="number" formControlName="maximumLength" step="1" min="6"/>
|
2023-12-08 16:06:46 +02:00
|
|
|
<mat-hint></mat-hint>
|
2023-12-07 12:52:13 +02:00
|
|
|
<mat-error *ngIf="securitySettingsFormGroup.get('passwordPolicy.maximumLength').hasError('min')">
|
|
|
|
|
{{ 'admin.maximum-password-length-min' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
<mat-error *ngIf="securitySettingsFormGroup.get('passwordPolicy.maximumLength').hasError('lessMin')">
|
|
|
|
|
{{ 'admin.maximum-password-length-less-min' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</div>
|
2022-11-14 11:05:47 +02:00
|
|
|
<div fxLayout="row" fxLayout.xs="column" fxLayoutGap.gt-xs="8px">
|
|
|
|
|
<mat-form-field fxFlex class="mat-block">
|
|
|
|
|
<mat-label translate>admin.minimum-uppercase-letters</mat-label>
|
|
|
|
|
<input matInput type="number"
|
|
|
|
|
formControlName="minimumUppercaseLetters"
|
|
|
|
|
step="1"
|
|
|
|
|
min="0"/>
|
|
|
|
|
<mat-error
|
|
|
|
|
*ngIf="securitySettingsFormGroup.get('passwordPolicy.minimumUppercaseLetters').hasError('min')">
|
|
|
|
|
{{ 'admin.minimum-uppercase-letters-range' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
<mat-form-field fxFlex class="mat-block">
|
|
|
|
|
<mat-label translate>admin.minimum-lowercase-letters</mat-label>
|
|
|
|
|
<input matInput type="number"
|
|
|
|
|
formControlName="minimumLowercaseLetters"
|
|
|
|
|
step="1"
|
|
|
|
|
min="0"/>
|
|
|
|
|
<mat-error
|
|
|
|
|
*ngIf="securitySettingsFormGroup.get('passwordPolicy.minimumLowercaseLetters').hasError('min')">
|
|
|
|
|
{{ 'admin.minimum-lowercase-letters-range' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</div>
|
|
|
|
|
<div fxLayout="row" fxLayout.xs="column" fxLayoutGap.gt-xs="8px">
|
|
|
|
|
<mat-form-field fxFlex class="mat-block">
|
|
|
|
|
<mat-label translate>admin.minimum-digits</mat-label>
|
|
|
|
|
<input matInput type="number"
|
|
|
|
|
formControlName="minimumDigits"
|
|
|
|
|
step="1"
|
|
|
|
|
min="0"/>
|
|
|
|
|
<mat-error *ngIf="securitySettingsFormGroup.get('passwordPolicy.minimumDigits').hasError('min')">
|
|
|
|
|
{{ 'admin.minimum-digits-range' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
<mat-form-field fxFlex class="mat-block">
|
|
|
|
|
<mat-label translate>admin.minimum-special-characters</mat-label>
|
|
|
|
|
<input matInput type="number"
|
|
|
|
|
formControlName="minimumSpecialCharacters"
|
|
|
|
|
step="1"
|
|
|
|
|
min="0"/>
|
|
|
|
|
<mat-error
|
|
|
|
|
*ngIf="securitySettingsFormGroup.get('passwordPolicy.minimumSpecialCharacters').hasError('min')">
|
|
|
|
|
{{ 'admin.minimum-special-characters-range' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</div>
|
|
|
|
|
<div fxLayout="row" fxLayout.xs="column" fxLayoutGap.gt-xs="8px">
|
|
|
|
|
<mat-form-field fxFlex class="mat-block">
|
|
|
|
|
<mat-label translate>admin.password-expiration-period-days</mat-label>
|
|
|
|
|
<input matInput type="number"
|
|
|
|
|
formControlName="passwordExpirationPeriodDays"
|
|
|
|
|
step="1"
|
|
|
|
|
min="0"/>
|
|
|
|
|
<mat-error
|
|
|
|
|
*ngIf="securitySettingsFormGroup.get('passwordPolicy.passwordExpirationPeriodDays').hasError('min')">
|
|
|
|
|
{{ 'admin.password-expiration-period-days-range' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
<mat-form-field fxFlex class="mat-block">
|
|
|
|
|
<mat-label translate>admin.password-reuse-frequency-days</mat-label>
|
|
|
|
|
<input matInput type="number"
|
|
|
|
|
formControlName="passwordReuseFrequencyDays"
|
|
|
|
|
step="1"
|
|
|
|
|
min="0"/>
|
|
|
|
|
<mat-error
|
|
|
|
|
*ngIf="securitySettingsFormGroup.get('passwordPolicy.passwordReuseFrequencyDays').hasError('min')">
|
|
|
|
|
{{ 'admin.password-reuse-frequency-days-range' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</div>
|
2023-12-07 12:52:13 +02:00
|
|
|
<div fxLayout="row" fxLayout.xs="column" fxLayoutGap.gt-xs="8px">
|
|
|
|
|
<mat-checkbox fxFlex formControlName="allowWhitespaces" style="margin-bottom: 16px">
|
|
|
|
|
<mat-label translate>admin.allow-whitespace</mat-label>
|
|
|
|
|
</mat-checkbox>
|
|
|
|
|
<mat-checkbox fxFlex formControlName="forceUserToResetPasswordIfNotValid" style="margin-bottom: 16px">
|
2023-12-08 16:06:46 +02:00
|
|
|
<mat-label tb-hint-tooltip-icon="{{'admin.force-reset-password-if-no-valid-hint' | translate}}">
|
2023-12-08 15:09:36 +02:00
|
|
|
{{'admin.force-reset-password-if-no-valid' | translate}}
|
|
|
|
|
</mat-label>
|
2023-12-07 12:52:13 +02:00
|
|
|
</mat-checkbox>
|
|
|
|
|
</div>
|
2022-11-14 11:05:47 +02:00
|
|
|
</section>
|
2019-08-12 19:34:23 +03:00
|
|
|
</fieldset>
|
2022-11-14 11:05:47 +02:00
|
|
|
<div fxLayout="row" fxLayoutAlign="end center" fxLayoutGap="8px" class="layout-wrap" style="margin-top: 16px">
|
|
|
|
|
<button mat-button color="primary"
|
|
|
|
|
[disabled]="securitySettingsFormGroup.pristine"
|
|
|
|
|
(click)="discardSetting()"
|
|
|
|
|
type="button">{{'action.undo' | translate}}
|
|
|
|
|
</button>
|
|
|
|
|
<button mat-button mat-raised-button color="primary" [disabled]="(isLoading$ | async) || securitySettingsFormGroup.invalid || !securitySettingsFormGroup.dirty"
|
|
|
|
|
type="submit">{{'action.save' | translate}}
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</fieldset>
|
|
|
|
|
</form>
|
|
|
|
|
</mat-card-content>
|
|
|
|
|
</mat-card>
|
2023-02-17 19:24:01 +02:00
|
|
|
<mat-card appearance="outlined" class="settings-card">
|
2023-02-20 19:23:26 +02:00
|
|
|
<mat-card-header>
|
|
|
|
|
<mat-card-title>
|
2023-02-17 19:24:01 +02:00
|
|
|
<span class="mat-headline-5" translate>admin.jwt.security-settings</span>
|
2023-02-20 19:23:26 +02:00
|
|
|
</mat-card-title>
|
2023-05-26 15:11:03 +03:00
|
|
|
<span fxFlex></span>
|
|
|
|
|
<div tb-help="jwtSecuritySettings"></div>
|
2023-02-20 19:23:26 +02:00
|
|
|
</mat-card-header>
|
2022-11-14 11:05:47 +02:00
|
|
|
<mat-card-content style="padding-top: 16px;">
|
|
|
|
|
<form [formGroup]="jwtSecuritySettingsFormGroup" (ngSubmit)="saveJwtSettings()" autocomplete="off">
|
2022-11-15 10:41:39 +02:00
|
|
|
<fieldset [disabled]="isLoading$ | async" fxLayout="column" fxLayoutGap="8px">
|
|
|
|
|
<div fxLayout="row" fxLayout.xs="column" fxLayoutGap="8px">
|
2022-11-14 11:05:47 +02:00
|
|
|
<mat-form-field fxFlex class="mat-block">
|
|
|
|
|
<mat-label translate>admin.jwt.issuer-name</mat-label>
|
|
|
|
|
<input matInput required formControlName="tokenIssuer"/>
|
|
|
|
|
<mat-error *ngIf="jwtSecuritySettingsFormGroup.get('tokenIssuer').hasError('required')">
|
|
|
|
|
{{ 'admin.jwt.issuer-name-required' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
<mat-form-field fxFlex class="mat-block">
|
|
|
|
|
<mat-label translate>admin.jwt.signings-key</mat-label>
|
2022-11-14 18:57:52 +02:00
|
|
|
<input matInput (focus)="markAsTouched()" required formControlName="tokenSigningKey"/>
|
2022-11-14 11:05:47 +02:00
|
|
|
<button type="button"
|
2022-11-15 11:29:12 +02:00
|
|
|
style="line-height: 32px"
|
2022-11-14 11:05:47 +02:00
|
|
|
matSuffix
|
|
|
|
|
mat-button
|
|
|
|
|
(click)="generateSigningKey()"
|
|
|
|
|
color="primary">
|
|
|
|
|
{{ 'admin.jwt.generate-key' | translate }}
|
|
|
|
|
</button>
|
2022-11-14 18:57:52 +02:00
|
|
|
<mat-hint translate>admin.jwt.signings-key-hint</mat-hint>
|
2022-11-14 11:05:47 +02:00
|
|
|
<mat-error *ngIf="jwtSecuritySettingsFormGroup.get('tokenSigningKey').hasError('required')">
|
|
|
|
|
{{ 'admin.jwt.signings-key-required' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
<mat-error *ngIf="jwtSecuritySettingsFormGroup.get('tokenSigningKey').hasError('base64')">
|
|
|
|
|
{{ 'admin.jwt.signings-key-base64' | translate }}
|
|
|
|
|
</mat-error>
|
2022-11-14 18:57:52 +02:00
|
|
|
<mat-error *ngIf="jwtSecuritySettingsFormGroup.get('tokenSigningKey').hasError('minLength')">
|
|
|
|
|
{{ 'admin.jwt.signings-key-min-length' | translate }}
|
|
|
|
|
</mat-error>
|
2022-11-14 11:05:47 +02:00
|
|
|
</mat-form-field>
|
|
|
|
|
</div>
|
2022-11-15 10:41:39 +02:00
|
|
|
<div fxLayout="row" fxLayout.xs="column" fxLayoutGap="8px">
|
2022-11-14 11:05:47 +02:00
|
|
|
<mat-form-field fxFlex class="mat-block">
|
|
|
|
|
<mat-label translate>admin.jwt.expiration-time</mat-label>
|
|
|
|
|
<input matInput type="number" required
|
|
|
|
|
formControlName="tokenExpirationTime"
|
|
|
|
|
step="1"
|
|
|
|
|
min="0"/>
|
|
|
|
|
<mat-error *ngIf="jwtSecuritySettingsFormGroup.get('tokenExpirationTime').hasError('required')">
|
|
|
|
|
{{ 'admin.jwt.expiration-time-required' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
<mat-error *ngIf="jwtSecuritySettingsFormGroup.get('tokenExpirationTime').hasError('pattern')">
|
|
|
|
|
{{ 'admin.jwt.expiration-time-pattern' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
<mat-error *ngIf="jwtSecuritySettingsFormGroup.get('tokenExpirationTime').hasError('min')">
|
|
|
|
|
{{ 'admin.jwt.expiration-time-min' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
<mat-form-field fxFlex class="mat-block">
|
|
|
|
|
<mat-label translate>admin.jwt.refresh-expiration-time</mat-label>
|
|
|
|
|
<input matInput type="number" required
|
|
|
|
|
formControlName="refreshTokenExpTime"
|
|
|
|
|
step="1"
|
|
|
|
|
min="0"/>
|
|
|
|
|
<mat-error *ngIf="jwtSecuritySettingsFormGroup.get('refreshTokenExpTime').hasError('required')">
|
|
|
|
|
{{ 'admin.jwt.refresh-expiration-time-required' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
<mat-error *ngIf="jwtSecuritySettingsFormGroup.get('refreshTokenExpTime').hasError('pattern')">
|
|
|
|
|
{{ 'admin.jwt.refresh-expiration-time-pattern' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
<mat-error *ngIf="jwtSecuritySettingsFormGroup.get('refreshTokenExpTime').hasError('min')">
|
|
|
|
|
{{ 'admin.jwt.refresh-expiration-time-min' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
<mat-error *ngIf="jwtSecuritySettingsFormGroup.get('refreshTokenExpTime').hasError('lessToken')">
|
|
|
|
|
{{ 'admin.jwt.refresh-expiration-time-less-token' | translate }}
|
|
|
|
|
</mat-error>
|
|
|
|
|
</mat-form-field>
|
|
|
|
|
</div>
|
|
|
|
|
<div fxLayout="row" fxLayoutAlign="end center" fxLayoutGap="8px" class="layout-wrap">
|
|
|
|
|
<button mat-button color="primary"
|
|
|
|
|
[disabled]="jwtSecuritySettingsFormGroup.pristine"
|
|
|
|
|
(click)="discardJwtSetting()"
|
|
|
|
|
type="button">{{'action.undo' | translate}}
|
|
|
|
|
</button>
|
|
|
|
|
<button mat-raised-button color="primary"
|
|
|
|
|
[disabled]="(isLoading$ | async) || jwtSecuritySettingsFormGroup.invalid || !jwtSecuritySettingsFormGroup.dirty"
|
|
|
|
|
type="submit">{{'action.save' | translate}}
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</fieldset>
|
|
|
|
|
</form>
|
|
|
|
|
</mat-card-content>
|
|
|
|
|
</mat-card>
|