misc score props moved to jslib

This commit is contained in:
Kyle Spearrin 2018-11-15 15:27:04 -05:00
parent be080f4f17
commit b48c484708
1 changed files with 30 additions and 0 deletions

View File

@ -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'),