mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 16:23:44 +00:00
54 lines
1.5 KiB
TypeScript
54 lines
1.5 KiB
TypeScript
import { Component, Input, OnInit } from "@angular/core";
|
|
|
|
import { MasterPasswordPolicyOptions } from "@bitwarden/common/admin-console/models/domain/master-password-policy-options";
|
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
|
import { CalloutTypes } from "@bitwarden/components";
|
|
|
|
/**
|
|
* @deprecated use the CL's `CalloutComponent` instead
|
|
*/
|
|
@Component({
|
|
selector: "app-callout",
|
|
templateUrl: "callout.component.html",
|
|
})
|
|
export class DeprecatedCalloutComponent implements OnInit {
|
|
@Input() type: CalloutTypes = "info";
|
|
@Input() icon: string;
|
|
@Input() title: string;
|
|
@Input() enforcedPolicyOptions: MasterPasswordPolicyOptions;
|
|
@Input() enforcedPolicyMessage: string;
|
|
@Input() useAlertRole = false;
|
|
|
|
calloutStyle: string;
|
|
|
|
constructor(private i18nService: I18nService) {}
|
|
|
|
ngOnInit() {
|
|
this.calloutStyle = this.type;
|
|
|
|
if (this.enforcedPolicyMessage === undefined) {
|
|
this.enforcedPolicyMessage = this.i18nService.t("masterPasswordPolicyInEffect");
|
|
}
|
|
}
|
|
|
|
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 + ")";
|
|
}
|
|
}
|