diff --git a/angular/src/components/callout.component.html b/angular/src/components/callout.component.html index 11405b4a584..8c0d8ea21a6 100644 --- a/angular/src/components/callout.component.html +++ b/angular/src/components/callout.component.html @@ -3,5 +3,24 @@ {{title}} +
+ {{enforcedPolicyMessage}} + +
diff --git a/angular/src/components/callout.component.ts b/angular/src/components/callout.component.ts index 2ecac179f40..45125c20119 100644 --- a/angular/src/components/callout.component.ts +++ b/angular/src/components/callout.component.ts @@ -6,6 +6,8 @@ import { import { I18nService } from 'jslib-common/abstractions/i18n.service'; +import { MasterPasswordPolicyOptions } from 'jslib-common/models/domain/masterPasswordPolicyOptions'; + @Component({ selector: 'app-callout', templateUrl: 'callout.component.html', @@ -15,6 +17,8 @@ export class CalloutComponent implements OnInit { @Input() icon: string; @Input() title: string; @Input() clickable: boolean; + @Input() enforcedPolicyOptions: MasterPasswordPolicyOptions; + @Input() enforcedPolicyMessage: string; calloutStyle: string; @@ -23,6 +27,10 @@ export class CalloutComponent implements OnInit { ngOnInit() { this.calloutStyle = this.type; + if (this.enforcedPolicyMessage === undefined) { + this.enforcedPolicyMessage = this.i18nService.t('masterPasswordPolicyInEffect'); + } + if (this.type === 'warning' || this.type === 'danger') { if (this.type === 'danger') { this.calloutStyle = 'danger'; @@ -51,4 +59,24 @@ export class CalloutComponent implements OnInit { } } } + + getPasswordScoreAlertDisplay() { + if (this.enforcedPolicyOptions == null) { + return ''; + } + + let str: string; + switch (this.enforcedPolicyOptions.minComplexity) { + case 4: + str = this.i18nService.t('strong'); + break; + case 3: + str = this.i18nService.t('good'); + break; + default: + str = this.i18nService.t('weak'); + break; + } + return str + ' (' + this.enforcedPolicyOptions.minComplexity + ')'; + } } diff --git a/angular/src/components/change-password.component.ts b/angular/src/components/change-password.component.ts index d0048f16995..5af79115d72 100644 --- a/angular/src/components/change-password.component.ts +++ b/angular/src/components/change-password.component.ts @@ -38,26 +38,6 @@ export class ChangePasswordComponent implements OnInit { this.enforcedPolicyOptions = await this.policyService.getMasterPasswordPolicyOptions(); } - getPasswordScoreAlertDisplay() { - if (this.enforcedPolicyOptions == null) { - return ''; - } - - let str: string; - switch (this.enforcedPolicyOptions.minComplexity) { - case 4: - str = this.i18nService.t('strong'); - break; - case 3: - str = this.i18nService.t('good'); - break; - default: - str = this.i18nService.t('weak'); - break; - } - return str + ' (' + this.enforcedPolicyOptions.minComplexity + ')'; - } - async submit() { if (!await this.strongPassword()) { return;