|
|
|
@ -31,6 +31,75 @@ |
|
|
|
<form [formGroup]="twoFaFormGroup" (ngSubmit)="save()"> |
|
|
|
<fieldset [disabled]="isLoading$ | async"> |
|
|
|
<ng-container> |
|
|
|
<fieldset class="fields-group" formArrayName="providers"> |
|
|
|
<legend class="group-title" translate>admin.2fa.available-providers</legend> |
|
|
|
<ng-container *ngFor="let provider of providersForm.controls; let i = index; let $last = last; trackBy: trackByElement"> |
|
|
|
<mat-expansion-panel class="provider" [formGroupName]="i"> |
|
|
|
<mat-expansion-panel-header> |
|
|
|
<mat-panel-title fxLayoutAlign="start center"> |
|
|
|
<mat-slide-toggle |
|
|
|
(click)="toggleProviders($event, i)" |
|
|
|
formControlName="enable"> |
|
|
|
</mat-slide-toggle> |
|
|
|
{{ provider.value.providerType }} |
|
|
|
</mat-panel-title> |
|
|
|
</mat-expansion-panel-header> |
|
|
|
|
|
|
|
<ng-template matExpansionPanelContent> |
|
|
|
<ng-container [ngSwitch]="provider.get('providerType').value"> |
|
|
|
<ng-container *ngSwitchCase="twoFactorAuthProviderType.TOTP"> |
|
|
|
<mat-form-field fxFlex class="mat-block"> |
|
|
|
<mat-label translate>admin.2fa.issuer-name</mat-label> |
|
|
|
<input matInput formControlName="issuerName" required> |
|
|
|
<mat-error *ngIf="provider.get('issuerName').hasError('required')"> |
|
|
|
{{ "admin.2fa.issuer-name-required" | translate }} |
|
|
|
</mat-error> |
|
|
|
</mat-form-field> |
|
|
|
</ng-container> |
|
|
|
<div *ngSwitchCase="twoFactorAuthProviderType.SMS" |
|
|
|
fxLayout="row" fxLayout.xs="column" fxLayoutGap.gt-xs="8px"> |
|
|
|
<mat-form-field fxFlex class="mat-block"> |
|
|
|
<mat-label translate>admin.2fa.verification-message-template</mat-label> |
|
|
|
<input matInput formControlName="smsVerificationMessageTemplate" required> |
|
|
|
<mat-error *ngIf="provider.get('smsVerificationMessageTemplate').hasError('required')"> |
|
|
|
{{ "admin.2fa.verification-message-template-required" | translate }} |
|
|
|
</mat-error> |
|
|
|
<mat-error *ngIf="provider.get('smsVerificationMessageTemplate').hasError('pattern')"> |
|
|
|
{{ "admin.2fa.verification-message-template-pattern" | translate }} |
|
|
|
</mat-error> |
|
|
|
</mat-form-field> |
|
|
|
|
|
|
|
<mat-form-field fxFlex class="mat-block"> |
|
|
|
<mat-label translate>admin.2fa.verification-code-lifetime</mat-label> |
|
|
|
<input matInput formControlName="verificationCodeLifetime" type="number" step="1" min="1" required> |
|
|
|
<mat-error *ngIf="provider.get('verificationCodeLifetime').hasError('required')"> |
|
|
|
{{ "admin.2fa.verification-code-lifetime-required" | translate }} |
|
|
|
</mat-error> |
|
|
|
<mat-error *ngIf="provider.get('verificationCodeLifetime').hasError('min') || |
|
|
|
provider.get('verificationCodeLifetime').hasError('pattern')"> |
|
|
|
{{ "admin.2fa.verification-code-lifetime-pattern" | translate }} |
|
|
|
</mat-error> |
|
|
|
</mat-form-field> |
|
|
|
</div> |
|
|
|
<div *ngSwitchCase="twoFactorAuthProviderType.EMAIL"> |
|
|
|
<mat-form-field fxFlex class="mat-block"> |
|
|
|
<mat-label translate>admin.2fa.verification-code-lifetime</mat-label> |
|
|
|
<input matInput formControlName="verificationCodeLifetime" type="number" step="1" min="1" required> |
|
|
|
<mat-error *ngIf="provider.get('verificationCodeLifetime').hasError('required')"> |
|
|
|
{{ "admin.2fa.verification-code-lifetime-required" | translate }} |
|
|
|
</mat-error> |
|
|
|
<mat-error *ngIf="provider.get('verificationCodeLifetime').hasError('min') || |
|
|
|
provider.get('verificationCodeLifetime').hasError('pattern')"> |
|
|
|
{{ "admin.2fa.verification-code-lifetime-pattern" | translate }} |
|
|
|
</mat-error> |
|
|
|
</mat-form-field> |
|
|
|
</div> |
|
|
|
</ng-container> |
|
|
|
</ng-template> |
|
|
|
</mat-expansion-panel> |
|
|
|
<mat-divider *ngIf="!$last"></mat-divider> |
|
|
|
</ng-container> |
|
|
|
</fieldset> |
|
|
|
<fieldset class="fields-group"> |
|
|
|
<legend class="group-title" translate>admin.2fa.verification-limitations</legend> |
|
|
|
<div class="input-row" fxLayout="row" fxLayout.xs="column" fxLayoutGap.gt-xs="8px"> |
|
|
|
@ -99,8 +168,7 @@ |
|
|
|
<mat-expansion-panel class="provider"> |
|
|
|
<mat-expansion-panel-header> |
|
|
|
<mat-panel-title fxLayoutAlign="start center"> |
|
|
|
<mat-slide-toggle class="rate-limit-toggle" |
|
|
|
(click)="toggleExtensionPanel($event, 1, twoFaFormGroup.get('verificationCodeCheckRateLimitEnable').value)" |
|
|
|
<mat-slide-toggle (click)="toggleExtensionPanel($event, 1, twoFaFormGroup.get('verificationCodeCheckRateLimitEnable').value)" |
|
|
|
formControlName="verificationCodeCheckRateLimitEnable"> |
|
|
|
</mat-slide-toggle> |
|
|
|
{{ 'admin.2fa.verification-code-check-rate-limit' | translate }} |
|
|
|
@ -134,75 +202,6 @@ |
|
|
|
</ng-template> |
|
|
|
</mat-expansion-panel> |
|
|
|
</fieldset> |
|
|
|
<fieldset class="fields-group" formArrayName="providers"> |
|
|
|
<legend class="group-title" translate>admin.2fa.available-providers</legend> |
|
|
|
<ng-container *ngFor="let provider of providersForm.controls; let i = index; let $last = last; trackBy: trackByElement"> |
|
|
|
<mat-expansion-panel class="provider" [formGroupName]="i"> |
|
|
|
<mat-expansion-panel-header> |
|
|
|
<mat-panel-title fxLayoutAlign="start center"> |
|
|
|
<mat-slide-toggle |
|
|
|
(click)="toggleProviders($event, i)" |
|
|
|
formControlName="enable"> |
|
|
|
</mat-slide-toggle> |
|
|
|
{{ provider.value.providerType }} |
|
|
|
</mat-panel-title> |
|
|
|
</mat-expansion-panel-header> |
|
|
|
|
|
|
|
<ng-template matExpansionPanelContent> |
|
|
|
<ng-container [ngSwitch]="provider.get('providerType').value"> |
|
|
|
<ng-container *ngSwitchCase="twoFactorAuthProviderType.TOTP"> |
|
|
|
<mat-form-field fxFlex class="mat-block"> |
|
|
|
<mat-label translate>admin.2fa.issuer-name</mat-label> |
|
|
|
<input matInput formControlName="issuerName" required> |
|
|
|
<mat-error *ngIf="provider.get('issuerName').hasError('required')"> |
|
|
|
{{ "admin.2fa.issuer-name-required" | translate }} |
|
|
|
</mat-error> |
|
|
|
</mat-form-field> |
|
|
|
</ng-container> |
|
|
|
<div *ngSwitchCase="twoFactorAuthProviderType.SMS" |
|
|
|
fxLayout="row" fxLayout.xs="column" fxLayoutGap.gt-xs="8px"> |
|
|
|
<mat-form-field fxFlex class="mat-block"> |
|
|
|
<mat-label translate>admin.2fa.verification-message-template</mat-label> |
|
|
|
<input matInput formControlName="smsVerificationMessageTemplate" required> |
|
|
|
<mat-error *ngIf="provider.get('smsVerificationMessageTemplate').hasError('required')"> |
|
|
|
{{ "admin.2fa.verification-message-template-required" | translate }} |
|
|
|
</mat-error> |
|
|
|
<mat-error *ngIf="provider.get('smsVerificationMessageTemplate').hasError('pattern')"> |
|
|
|
{{ "admin.2fa.verification-message-template-pattern" | translate }} |
|
|
|
</mat-error> |
|
|
|
</mat-form-field> |
|
|
|
|
|
|
|
<mat-form-field fxFlex class="mat-block"> |
|
|
|
<mat-label translate>admin.2fa.verification-code-lifetime</mat-label> |
|
|
|
<input matInput formControlName="verificationCodeLifetime" type="number" step="1" min="1" required> |
|
|
|
<mat-error *ngIf="provider.get('verificationCodeLifetime').hasError('required')"> |
|
|
|
{{ "admin.2fa.verification-code-lifetime-required" | translate }} |
|
|
|
</mat-error> |
|
|
|
<mat-error *ngIf="provider.get('verificationCodeLifetime').hasError('min') || |
|
|
|
provider.get('verificationCodeLifetime').hasError('pattern')"> |
|
|
|
{{ "admin.2fa.verification-code-lifetime-pattern" | translate }} |
|
|
|
</mat-error> |
|
|
|
</mat-form-field> |
|
|
|
</div> |
|
|
|
<div *ngSwitchCase="twoFactorAuthProviderType.EMAIL"> |
|
|
|
<mat-form-field fxFlex class="mat-block"> |
|
|
|
<mat-label translate>admin.2fa.verification-code-lifetime</mat-label> |
|
|
|
<input matInput formControlName="verificationCodeLifetime" type="number" step="1" min="1" required> |
|
|
|
<mat-error *ngIf="provider.get('verificationCodeLifetime').hasError('required')"> |
|
|
|
{{ "admin.2fa.verification-code-lifetime-required" | translate }} |
|
|
|
</mat-error> |
|
|
|
<mat-error *ngIf="provider.get('verificationCodeLifetime').hasError('min') || |
|
|
|
provider.get('verificationCodeLifetime').hasError('pattern')"> |
|
|
|
{{ "admin.2fa.verification-code-lifetime-pattern" | translate }} |
|
|
|
</mat-error> |
|
|
|
</mat-form-field> |
|
|
|
</div> |
|
|
|
</ng-container> |
|
|
|
</ng-template> |
|
|
|
</mat-expansion-panel> |
|
|
|
<mat-divider *ngIf="!$last"></mat-divider> |
|
|
|
</ng-container> |
|
|
|
</fieldset> |
|
|
|
<div fxLayout="row" fxLayoutAlign="end center" fxLayoutGap="8px"> |
|
|
|
<button mat-button mat-raised-button color="primary" |
|
|
|
[disabled]="(isLoading$ | async) || twoFaFormGroup.invalid || !twoFaFormGroup.dirty" |
|
|
|
|