1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 09:13:33 +00:00

Update complexity score display (#479)

* Update complexity score

* Simplifying switch statement
This commit is contained in:
Vincent Salucci
2020-03-03 15:37:54 -06:00
committed by GitHub
parent e7e5816ded
commit 305d86f765
6 changed files with 52 additions and 6 deletions

View File

@@ -27,9 +27,9 @@ import { PolicyData } from 'jslib/models/data/policyData';
export class RegisterComponent extends BaseRegisterComponent {
showCreateOrgMessage = false;
showTerms = true;
enforcedPolicyOptions: MasterPasswordPolicyOptions;
private policies: Policy[];
enforcedPolicyOptions: MasterPasswordPolicyOptions;
constructor(authService: AuthService, router: Router,
i18nService: I18nService, cryptoService: CryptoService,
@@ -41,6 +41,23 @@ export class RegisterComponent extends BaseRegisterComponent {
this.showTerms = !platformUtilsService.isSelfHost();
}
getPasswordScoreAlertDisplay() {
if (this.enforcedPolicyOptions == null) {
return '';
}
let str: string;
switch (this.enforcedPolicyOptions.minComplexity) {
case 4:
str = this.i18nService.t('strong');
case 3:
str = this.i18nService.t('good');
default:
str = this.i18nService.t('weak');
}
return str + ' (' + this.enforcedPolicyOptions.minComplexity + ')';
}
async ngOnInit() {
const queryParamsSub = this.route.queryParams.subscribe((qParams) => {
if (qParams.email != null && qParams.email.indexOf('@') > -1) {