diff --git a/apps/web/src/app/accounts/update-temp-password.component.html b/apps/web/src/app/accounts/update-temp-password.component.html index ea7dc8c3a9..57cf23ad03 100644 --- a/apps/web/src/app/accounts/update-temp-password.component.html +++ b/apps/web/src/app/accounts/update-temp-password.component.html @@ -28,6 +28,7 @@ [password]="masterPassword" [email]="email" [showText]="true" + (passwordStrengthResult)="getStrengthResult($event)" > diff --git a/apps/web/src/app/organizations/manage/reset-password.component.html b/apps/web/src/app/organizations/manage/reset-password.component.html index ea6e75fee8..675a17e4b0 100644 --- a/apps/web/src/app/organizations/manage/reset-password.component.html +++ b/apps/web/src/app/organizations/manage/reset-password.component.html @@ -77,7 +77,12 @@ - + diff --git a/apps/web/src/app/organizations/manage/reset-password.component.ts b/apps/web/src/app/organizations/manage/reset-password.component.ts index 84c9a5c143..93fb6ff75f 100644 --- a/apps/web/src/app/organizations/manage/reset-password.component.ts +++ b/apps/web/src/app/organizations/manage/reset-password.component.ts @@ -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; 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; + } }