From 2282a74abda260dd21916c3e330409c2a3e181e8 Mon Sep 17 00:00:00 2001 From: Jordan Aasen <166539328+jaasen-livefront@users.noreply.github.com> Date: Fri, 9 May 2025 18:09:26 -0700 Subject: [PATCH] [PM-21021] - fix toggled hidden field state for custom fields view (#14595) * fix toggled hidden field state for custom fields view * fix hidden field toggle for cards and login details --- .../card-details-view.component.html | 2 ++ .../card-details-view.component.ts | 19 +++++++++++++++++-- .../custom-fields-v2.component.ts | 10 ++++++++-- .../login-credentials-view.component.html | 1 + .../login-credentials-view.component.ts | 19 +++++++++++++++++-- 5 files changed, 45 insertions(+), 6 deletions(-) diff --git a/libs/vault/src/cipher-view/card-details/card-details-view.component.html b/libs/vault/src/cipher-view/card-details/card-details-view.component.html index fff771b6465..ff61addd7db 100644 --- a/libs/vault/src/cipher-view/card-details/card-details-view.component.html +++ b/libs/vault/src/cipher-view/card-details/card-details-view.component.html @@ -33,6 +33,7 @@ bitIconButton bitPasswordInputToggle data-testid="toggle-number" + [toggled]="revealCardNumber" (toggledChange)="logCardEvent($event, EventType.Cipher_ClientToggledCardNumberVisible)" > diff --git a/libs/vault/src/cipher-view/login-credentials/login-credentials-view.component.ts b/libs/vault/src/cipher-view/login-credentials/login-credentials-view.component.ts index 27d81f32ee6..d99ac438f27 100644 --- a/libs/vault/src/cipher-view/login-credentials/login-credentials-view.component.ts +++ b/libs/vault/src/cipher-view/login-credentials/login-credentials-view.component.ts @@ -1,7 +1,15 @@ // FIXME: Update this file to be type safe and remove this and next line // @ts-strict-ignore import { CommonModule, DatePipe } from "@angular/common"; -import { Component, EventEmitter, inject, Input, Output } from "@angular/core"; +import { + Component, + EventEmitter, + inject, + Input, + OnChanges, + Output, + SimpleChanges, +} from "@angular/core"; import { Observable, switchMap } from "rxjs"; import { JslibModule } from "@bitwarden/angular/jslib.module"; @@ -51,7 +59,7 @@ type TotpCodeValues = { LinkModule, ], }) -export class LoginCredentialsViewComponent { +export class LoginCredentialsViewComponent implements OnChanges { @Input() cipher: CipherView; @Input() activeUserId: UserId; @Input() hadPendingChangePasswordTask: boolean; @@ -85,6 +93,13 @@ export class LoginCredentialsViewComponent { return `${dateCreated} ${creationDate}`; } + ngOnChanges(changes: SimpleChanges): void { + if (changes["cipher"]) { + this.passwordRevealed = false; + this.showPasswordCount = false; + } + } + async getPremium(organizationId?: string) { await this.premiumUpgradeService.promptForPremium(organizationId); }