From f4792c39e897e0fd2fbdc1ed520ba4f2bda32a28 Mon Sep 17 00:00:00 2001 From: cd-bitwarden <106776772+cd-bitwarden@users.noreply.github.com> Date: Tue, 21 Jan 2025 16:00:31 -0500 Subject: [PATCH] =?UTF-8?q?Revert=20"[PM-13938]=20Changes=20to=20disabled?= =?UTF-8?q?=20user=20from=20seeing=20password=20that=20they=20sh=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit cc7defc4475bfe237d1fb13b4135a62288def55f. --- .../custom-fields/custom-fields.component.html | 2 +- .../custom-fields.component.spec.ts | 17 ++--------------- .../custom-fields-v2.component.html | 2 -- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/libs/vault/src/cipher-form/components/custom-fields/custom-fields.component.html b/libs/vault/src/cipher-form/components/custom-fields/custom-fields.component.html index fab3c8f1ab1..63941c6a467 100644 --- a/libs/vault/src/cipher-form/components/custom-fields/custom-fields.component.html +++ b/libs/vault/src/cipher-form/components/custom-fields/custom-fields.component.html @@ -46,7 +46,7 @@ bitSuffix bitPasswordInputToggle data-testid="visibility-for-custom-hidden-field" - *ngIf="canViewPasswords(i)" + [disabled]="!canViewPasswords(i)" (toggledChange)="logHiddenEvent($event)" > diff --git a/libs/vault/src/cipher-form/components/custom-fields/custom-fields.component.spec.ts b/libs/vault/src/cipher-form/components/custom-fields/custom-fields.component.spec.ts index b523d9ef933..a5e57d2858f 100644 --- a/libs/vault/src/cipher-form/components/custom-fields/custom-fields.component.spec.ts +++ b/libs/vault/src/cipher-form/components/custom-fields/custom-fields.component.spec.ts @@ -113,7 +113,7 @@ describe("CustomFieldsComponent", () => { ]); }); - it("when `viewPassword` is false the user cannot see the view toggle option", () => { + it("forbids a user to view hidden fields when the cipher `viewPassword` is false", () => { originalCipherView.viewPassword = false; originalCipherView.fields = mockFieldViews; @@ -123,20 +123,7 @@ describe("CustomFieldsComponent", () => { const button = fixture.debugElement.query(By.directive(BitPasswordInputToggleDirective)); - expect(button).toBeFalsy(); - }); - - it("when `viewPassword` is true the user can see the view toggle option", () => { - originalCipherView.viewPassword = true; - originalCipherView.fields = mockFieldViews; - - component.ngOnInit(); - - fixture.detectChanges(); - - const button = fixture.debugElement.query(By.directive(BitPasswordInputToggleDirective)); - - expect(button).toBeTruthy(); + expect(button.nativeElement.disabled).toBe(true); }); describe("linkedFieldOptions", () => { diff --git a/libs/vault/src/cipher-view/custom-fields/custom-fields-v2.component.html b/libs/vault/src/cipher-view/custom-fields/custom-fields-v2.component.html index 8eee79729af..ab31ede57bb 100644 --- a/libs/vault/src/cipher-view/custom-fields/custom-fields-v2.component.html +++ b/libs/vault/src/cipher-view/custom-fields/custom-fields-v2.component.html @@ -36,7 +36,6 @@