From 7053d0c7ecc882ac8e1e9f45260676ff7877210b Mon Sep 17 00:00:00 2001 From: KiruthigaManivannan <162679756+KiruthigaManivannan@users.noreply.github.com> Date: Tue, 21 May 2024 18:46:31 +0530 Subject: [PATCH] AC-2390 Migrate Password Generator component (#8799) --- .../password-generator.component.html | 194 +++++------------- .../policies/password-generator.component.ts | 10 +- 2 files changed, 62 insertions(+), 142 deletions(-) diff --git a/apps/web/src/app/admin-console/organizations/policies/password-generator.component.html b/apps/web/src/app/admin-console/organizations/policies/password-generator.component.html index 350f7da7b4..80df5fa2e6 100644 --- a/apps/web/src/app/admin-console/organizations/policies/password-generator.component.html +++ b/apps/web/src/app/admin-console/organizations/policies/password-generator.component.html @@ -1,144 +1,64 @@
-
-
- - -
+ + + {{ "turnOn" | i18n }} + + +
+ + {{ "defaultType" | i18n }} + + + +
-
-
- - -
+

{{ "password" | i18n }}

+
+ + {{ "minLength" | i18n }} + +
-

{{ "password" | i18n }}

-
-
- - -
+
+ + {{ "minNumbers" | i18n }} + + + + {{ "minSpecial" | i18n }} + +
-
-
- - -
-
- - -
-
-
- - -
-
- - -
-
- - -
-
- - -
-

{{ "passphrase" | i18n }}

-
-
- - -
-
-
- - -
-
- - + + + A-Z + + + + a-z + + + + 0-9 + + + + !@#$%^&* + +

{{ "passphrase" | i18n }}

+
+ + {{ "minimumNumberOfWords" | i18n }} + +
+ + + {{ "capitalize" | i18n }} + + + + {{ "includeNumber" | i18n }} +
diff --git a/apps/web/src/app/admin-console/organizations/policies/password-generator.component.ts b/apps/web/src/app/admin-console/organizations/policies/password-generator.component.ts index 464586d685..93124c42fa 100644 --- a/apps/web/src/app/admin-console/organizations/policies/password-generator.component.ts +++ b/apps/web/src/app/admin-console/organizations/policies/password-generator.component.ts @@ -1,5 +1,5 @@ import { Component } from "@angular/core"; -import { UntypedFormBuilder } from "@angular/forms"; +import { UntypedFormBuilder, Validators } from "@angular/forms"; import { PolicyType } from "@bitwarden/common/admin-console/enums"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; @@ -20,14 +20,14 @@ export class PasswordGeneratorPolicy extends BasePolicy { export class PasswordGeneratorPolicyComponent extends BasePolicyComponent { data = this.formBuilder.group({ defaultType: [null], - minLength: [null], + minLength: [null, [Validators.min(5), Validators.max(128)]], useUpper: [null], useLower: [null], useNumbers: [null], useSpecial: [null], - minNumbers: [null], - minSpecial: [null], - minNumberWords: [null], + minNumbers: [null, [Validators.min(0), Validators.max(9)]], + minSpecial: [null, [Validators.min(0), Validators.max(9)]], + minNumberWords: [null, [Validators.min(3), Validators.max(20)]], capitalize: [null], includeNumber: [null], });