1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-02-01 23:01:28 +01:00

[PM-13938] Changes to disabled user from seeing password that they shouldn't see or edit easily. (#12161)

* Changes to disabled user from seeing password that they shouldn't see or edit easily.

* Fixing defects on PM-13938

* undoing unecessary change

* Updating tests

---------

Co-authored-by: --global <>
Co-authored-by: kejaeger <138028972+kejaeger@users.noreply.github.com>
This commit is contained in:
cd-bitwarden 2025-01-21 14:50:05 -05:00 committed by GitHub
parent 007e2fc951
commit cc7defc447
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 3 deletions

View File

@ -46,7 +46,7 @@
bitSuffix
bitPasswordInputToggle
data-testid="visibility-for-custom-hidden-field"
[disabled]="!canViewPasswords(i)"
*ngIf="canViewPasswords(i)"
(toggledChange)="logHiddenEvent($event)"
></button>
</bit-form-field>

View File

@ -113,7 +113,7 @@ describe("CustomFieldsComponent", () => {
]);
});
it("forbids a user to view hidden fields when the cipher `viewPassword` is false", () => {
it("when `viewPassword` is false the user cannot see the view toggle option", () => {
originalCipherView.viewPassword = false;
originalCipherView.fields = mockFieldViews;
@ -123,7 +123,20 @@ describe("CustomFieldsComponent", () => {
const button = fixture.debugElement.query(By.directive(BitPasswordInputToggleDirective));
expect(button.nativeElement.disabled).toBe(true);
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();
});
describe("linkedFieldOptions", () => {

View File

@ -36,6 +36,7 @@
<button
bitSuffix
type="button"
*ngIf="this.cipher.viewPassword"
bitIconButton
bitPasswordInputToggle
*ngIf="canViewPassword"
@ -44,6 +45,7 @@
<button
bitIconButton="bwi-clone"
bitSuffix
*ngIf="this.cipher.viewPassword"
type="button"
[appCopyClick]="field.value"
showToast