From b48c48470801eb88aaec2c2cd84baeb6f1876923 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 15 Nov 2018 15:27:04 -0500 Subject: [PATCH] misc score props moved to jslib --- src/angular/components/register.component.ts | 30 ++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/angular/components/register.component.ts b/src/angular/components/register.component.ts index 92acafe8..a990aae0 100644 --- a/src/angular/components/register.component.ts +++ b/src/angular/components/register.component.ts @@ -32,6 +32,36 @@ export class RegisterComponent { protected platformUtilsService: PlatformUtilsService, protected passwordGenerationService: PasswordGenerationService) { } + get masterPasswordScoreWidth() { + return this.masterPasswordScore == null ? 0 : (this.masterPasswordScore + 1) * 20; + } + + get masterPasswordScoreColor() { + switch (this.masterPasswordScore) { + case 4: + return 'success'; + case 3: + return 'primary'; + case 2: + return 'warning'; + default: + return 'danger'; + } + } + + get masterPasswordScoreText() { + switch (this.masterPasswordScore) { + case 4: + return this.i18nService.t('strong'); + case 3: + return this.i18nService.t('good'); + case 2: + return this.i18nService.t('weak'); + default: + return this.masterPasswordScore != null ? this.i18nService.t('weak') : null; + } + } + async submit() { if (this.email == null || this.email === '') { this.platformUtilsService.showToast('error', this.i18nService.t('errorOccurred'),