2020-08-25 16:49:24 +02:00
|
|
|
import { Component } from '@angular/core';
|
|
|
|
|
2020-10-14 15:58:36 +02:00
|
|
|
import {
|
|
|
|
ActivatedRoute,
|
|
|
|
Router,
|
|
|
|
} from '@angular/router';
|
2020-08-25 16:49:24 +02:00
|
|
|
|
2021-06-07 19:25:37 +02:00
|
|
|
import { ApiService } from 'jslib-common/abstractions/api.service';
|
|
|
|
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
|
|
|
|
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
|
|
|
import { MessagingService } from 'jslib-common/abstractions/messaging.service';
|
|
|
|
import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service';
|
|
|
|
import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service';
|
|
|
|
import { PolicyService } from 'jslib-common/abstractions/policy.service';
|
|
|
|
import { SyncService } from 'jslib-common/abstractions/sync.service';
|
|
|
|
import { UserService } from 'jslib-common/abstractions/user.service';
|
2020-08-25 16:49:24 +02:00
|
|
|
|
|
|
|
import {
|
|
|
|
SetPasswordComponent as BaseSetPasswordComponent,
|
2021-06-07 19:25:37 +02:00
|
|
|
} from 'jslib-angular/components/set-password.component';
|
2020-08-25 16:49:24 +02:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-set-password',
|
|
|
|
templateUrl: 'set-password.component.html',
|
|
|
|
})
|
|
|
|
export class SetPasswordComponent extends BaseSetPasswordComponent {
|
|
|
|
constructor(apiService: ApiService, i18nService: I18nService,
|
|
|
|
cryptoService: CryptoService, messagingService: MessagingService,
|
|
|
|
userService: UserService, passwordGenerationService: PasswordGenerationService,
|
2020-08-31 20:21:59 +02:00
|
|
|
platformUtilsService: PlatformUtilsService, policyService: PolicyService, router: Router,
|
2020-10-14 15:58:36 +02:00
|
|
|
syncService: SyncService, route: ActivatedRoute) {
|
2020-08-25 16:49:24 +02:00
|
|
|
super(i18nService, cryptoService, messagingService, userService, passwordGenerationService,
|
2020-10-14 15:58:36 +02:00
|
|
|
platformUtilsService, policyService, router, apiService, syncService, route);
|
2020-08-25 16:49:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2020-08-31 20:21:59 +02:00
|
|
|
}
|