mirror of
https://github.com/bitwarden/browser
synced 2025-12-11 13:53:34 +00: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:
@@ -46,7 +46,7 @@
|
|||||||
bitSuffix
|
bitSuffix
|
||||||
bitPasswordInputToggle
|
bitPasswordInputToggle
|
||||||
data-testid="visibility-for-custom-hidden-field"
|
data-testid="visibility-for-custom-hidden-field"
|
||||||
[disabled]="!canViewPasswords(i)"
|
*ngIf="canViewPasswords(i)"
|
||||||
(toggledChange)="logHiddenEvent($event)"
|
(toggledChange)="logHiddenEvent($event)"
|
||||||
></button>
|
></button>
|
||||||
</bit-form-field>
|
</bit-form-field>
|
||||||
|
|||||||
@@ -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.viewPassword = false;
|
||||||
originalCipherView.fields = mockFieldViews;
|
originalCipherView.fields = mockFieldViews;
|
||||||
|
|
||||||
@@ -123,7 +123,20 @@ describe("CustomFieldsComponent", () => {
|
|||||||
|
|
||||||
const button = fixture.debugElement.query(By.directive(BitPasswordInputToggleDirective));
|
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", () => {
|
describe("linkedFieldOptions", () => {
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
<button
|
<button
|
||||||
bitSuffix
|
bitSuffix
|
||||||
type="button"
|
type="button"
|
||||||
|
*ngIf="this.cipher.viewPassword"
|
||||||
bitIconButton
|
bitIconButton
|
||||||
bitPasswordInputToggle
|
bitPasswordInputToggle
|
||||||
*ngIf="canViewPassword"
|
*ngIf="canViewPassword"
|
||||||
@@ -44,6 +45,7 @@
|
|||||||
<button
|
<button
|
||||||
bitIconButton="bwi-clone"
|
bitIconButton="bwi-clone"
|
||||||
bitSuffix
|
bitSuffix
|
||||||
|
*ngIf="this.cipher.viewPassword"
|
||||||
type="button"
|
type="button"
|
||||||
[appCopyClick]="field.value"
|
[appCopyClick]="field.value"
|
||||||
showToast
|
showToast
|
||||||
|
|||||||
Reference in New Issue
Block a user