use new tools-password-strength component (#10125)
This commit is contained in:
parent
69a37a884f
commit
e2c99c2cdf
|
@ -27,12 +27,12 @@
|
||||||
</bit-hint>
|
</bit-hint>
|
||||||
</bit-form-field>
|
</bit-form-field>
|
||||||
|
|
||||||
<app-password-strength
|
<tools-password-strength
|
||||||
[password]="formGroup.controls.password.value"
|
|
||||||
[email]="email"
|
|
||||||
[showText]="true"
|
[showText]="true"
|
||||||
(passwordStrengthResult)="getPasswordStrengthResult($event)"
|
[email]="email"
|
||||||
></app-password-strength>
|
[password]="formGroup.controls.password.value"
|
||||||
|
(passwordStrengthScore)="getPasswordStrengthScore($event)"
|
||||||
|
></tools-password-strength>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<bit-form-field>
|
<bit-form-field>
|
||||||
|
|
|
@ -2,6 +2,10 @@ import { Component, EventEmitter, Input, OnInit, Output } from "@angular/core";
|
||||||
import { ReactiveFormsModule, FormBuilder, Validators } from "@angular/forms";
|
import { ReactiveFormsModule, FormBuilder, Validators } from "@angular/forms";
|
||||||
|
|
||||||
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
||||||
|
import {
|
||||||
|
PasswordStrengthScore,
|
||||||
|
PasswordStrengthV2Component,
|
||||||
|
} from "@bitwarden/angular/tools/password-strength/password-strength-v2.component";
|
||||||
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
|
import { AuditService } from "@bitwarden/common/abstractions/audit.service";
|
||||||
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
|
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
|
||||||
import { MasterPasswordPolicyOptions } from "@bitwarden/common/admin-console/models/domain/master-password-policy-options";
|
import { MasterPasswordPolicyOptions } from "@bitwarden/common/admin-console/models/domain/master-password-policy-options";
|
||||||
|
@ -40,6 +44,7 @@ import { PasswordInputResult } from "./password-input-result";
|
||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
SharedModule,
|
SharedModule,
|
||||||
PasswordCalloutComponent,
|
PasswordCalloutComponent,
|
||||||
|
PasswordStrengthV2Component,
|
||||||
JslibModule,
|
JslibModule,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
@ -56,7 +61,7 @@ export class InputPasswordComponent implements OnInit {
|
||||||
|
|
||||||
protected minPasswordLength = Utils.minimumPasswordLength;
|
protected minPasswordLength = Utils.minimumPasswordLength;
|
||||||
protected minPasswordMsg = "";
|
protected minPasswordMsg = "";
|
||||||
protected passwordStrengthResult: any;
|
protected passwordStrengthScore: PasswordStrengthScore;
|
||||||
protected showErrorSummary = false;
|
protected showErrorSummary = false;
|
||||||
protected showPassword = false;
|
protected showPassword = false;
|
||||||
|
|
||||||
|
@ -112,8 +117,8 @@ export class InputPasswordComponent implements OnInit {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getPasswordStrengthResult(result: any) {
|
getPasswordStrengthScore(score: PasswordStrengthScore) {
|
||||||
this.passwordStrengthResult = result;
|
this.passwordStrengthScore = score;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected submit = async () => {
|
protected submit = async () => {
|
||||||
|
@ -147,7 +152,7 @@ export class InputPasswordComponent implements OnInit {
|
||||||
if (
|
if (
|
||||||
this.masterPasswordPolicyOptions != null &&
|
this.masterPasswordPolicyOptions != null &&
|
||||||
!this.policyService.evaluateMasterPassword(
|
!this.policyService.evaluateMasterPassword(
|
||||||
this.passwordStrengthResult.score,
|
this.passwordStrengthScore,
|
||||||
password,
|
password,
|
||||||
this.masterPasswordPolicyOptions,
|
this.masterPasswordPolicyOptions,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue