[SG-414] Weak password prompt not displaying on master password reset (#3241)
* moved password strength to libs * refactored password strength component * made changes on desktop and browser to reuse component * resolved suggestions from PR review * shared module restructure * shared module restructure * Fixed no warning prompt on reset password * SG-519 setting new password warning prompt fix * removed any and added type
This commit is contained in:
parent
ecd6863abe
commit
31cae4390f
|
@ -28,6 +28,7 @@
|
|||
[password]="masterPassword"
|
||||
[email]="email"
|
||||
[showText]="true"
|
||||
(passwordStrengthResult)="getStrengthResult($event)"
|
||||
>
|
||||
</app-password-strength>
|
||||
</div>
|
||||
|
|
|
@ -77,7 +77,12 @@
|
|||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<app-password-strength [password]="newPassword" [email]="email" [showText]="true">
|
||||
<app-password-strength
|
||||
[password]="newPassword"
|
||||
[email]="email"
|
||||
[showText]="true"
|
||||
(passwordStrengthResult)="getStrengthResult($event)"
|
||||
>
|
||||
</app-password-strength>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from "@angular/core";
|
||||
import zxcvbn from "zxcvbn";
|
||||
|
||||
import { PasswordStrengthComponent } from "@bitwarden/angular/shared/components/password-strength/password-strength.component";
|
||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||
|
@ -28,7 +29,7 @@ export class ResetPasswordComponent implements OnInit {
|
|||
enforcedPolicyOptions: MasterPasswordPolicyOptions;
|
||||
newPassword: string = null;
|
||||
showPassword = false;
|
||||
masterPasswordScore: number;
|
||||
passwordStrengthResult: zxcvbn.ZXCVBNResult;
|
||||
formPromise: Promise<any>;
|
||||
|
||||
constructor(
|
||||
|
@ -97,7 +98,7 @@ export class ResetPasswordComponent implements OnInit {
|
|||
if (
|
||||
this.enforcedPolicyOptions != null &&
|
||||
!this.policyService.evaluateMasterPassword(
|
||||
this.masterPasswordScore,
|
||||
this.passwordStrengthResult.score,
|
||||
this.newPassword,
|
||||
this.enforcedPolicyOptions
|
||||
)
|
||||
|
@ -110,7 +111,7 @@ export class ResetPasswordComponent implements OnInit {
|
|||
return;
|
||||
}
|
||||
|
||||
if (this.masterPasswordScore < 3) {
|
||||
if (this.passwordStrengthResult.score < 3) {
|
||||
const result = await this.platformUtilsService.showDialog(
|
||||
this.i18nService.t("weakMasterPasswordDesc"),
|
||||
this.i18nService.t("weakMasterPassword"),
|
||||
|
@ -184,4 +185,8 @@ export class ResetPasswordComponent implements OnInit {
|
|||
this.logService.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
getStrengthResult(result: zxcvbn.ZXCVBNResult) {
|
||||
this.passwordStrengthResult = result;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue