diff --git a/src/angular/components/register.component.ts b/src/angular/components/register.component.ts index 92acafe88d..a990aae0b8 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'),