From 6c529422048c95645304ceb14250c8efce938f34 Mon Sep 17 00:00:00 2001 From: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Date: Fri, 28 Feb 2020 11:09:57 -0600 Subject: [PATCH] Show policy in effect banner for password generator (#76) --- .../components/password-generator.component.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/angular/components/password-generator.component.ts b/src/angular/components/password-generator.component.ts index f35892d7b2..a62d308cdf 100644 --- a/src/angular/components/password-generator.component.ts +++ b/src/angular/components/password-generator.component.ts @@ -79,6 +79,24 @@ export class PasswordGeneratorComponent implements OnInit { this.showOptions = !this.showOptions; } + hasPolicyInEffect() { + if (this.enforcedPolicyOptions == null) { + return false; + } + + if (this.enforcedPolicyOptions.minLength > 0 + || this.enforcedPolicyOptions.numberCount > 0 + || this.enforcedPolicyOptions.specialCount > 0 + || this.enforcedPolicyOptions.useUppercase + || this.enforcedPolicyOptions.useLowercase + || this.enforcedPolicyOptions.useNumbers + || this.enforcedPolicyOptions.useSpecial) { + return true; + } else { + return false; + } + } + private normalizeOptions() { this.options.minLowercase = 0; this.options.minUppercase = 0;