diff --git a/libs/vault/src/cipher-view/login-credentials/login-credentials-view.component.html b/libs/vault/src/cipher-view/login-credentials/login-credentials-view.component.html index 828ac25a14..78b5becfc4 100644 --- a/libs/vault/src/cipher-view/login-credentials/login-credentials-view.component.html +++ b/libs/vault/src/cipher-view/login-credentials/login-credentials-view.component.html @@ -106,7 +106,7 @@ readonly bitInput [type]="!(isPremium$ | async) ? 'password' : 'text'" - [value]="totpCopyCode || '*** ***'" + [value]="totpCodeCopyObj?.totpCodeFormatted || '*** ***'" aria-readonly="true" data-testid="login-totp" [disabled]="!(isPremium$ | async)" @@ -124,7 +124,7 @@ bitIconButton="bwi-clone" bitSuffix type="button" - [appCopyClick]="totpCopyCode" + [appCopyClick]="totpCodeCopyObj?.totpCode" [valueLabel]="'verificationCodeTotp' | i18n" showToast [appA11yTitle]="'copyValue' | i18n" 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 d8683a4407..3973a66684 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 @@ -20,6 +20,11 @@ import { import { BitTotpCountdownComponent } from "../../components/totp-countdown/totp-countdown.component"; +type TotpCodeValues = { + totpCode: string; + totpCodeFormatted?: string; +}; + @Component({ selector: "app-login-credentials-view", templateUrl: "login-credentials-view.component.html", @@ -47,7 +52,7 @@ export class LoginCredentialsViewComponent { ); showPasswordCount: boolean = false; passwordRevealed: boolean = false; - totpCopyCode: string; + totpCodeCopyObj: TotpCodeValues; private datePipe = inject(DatePipe); constructor( @@ -77,7 +82,7 @@ export class LoginCredentialsViewComponent { this.showPasswordCount = !this.showPasswordCount; } - setTotpCopyCode(e: any) { - this.totpCopyCode = e; + setTotpCopyCode(e: TotpCodeValues) { + this.totpCodeCopyObj = e; } } diff --git a/libs/vault/src/components/totp-countdown/totp-countdown.component.ts b/libs/vault/src/components/totp-countdown/totp-countdown.component.ts index aeb7d30654..f93e8400b0 100644 --- a/libs/vault/src/components/totp-countdown/totp-countdown.component.ts +++ b/libs/vault/src/components/totp-countdown/totp-countdown.component.ts @@ -44,13 +44,16 @@ export class BitTotpCountdownComponent implements OnInit { if (this.totpCode != null) { if (this.totpCode.length > 4) { this.totpCodeFormatted = this.formatTotpCode(); - this.sendCopyCode.emit(this.totpCodeFormatted); + this.sendCopyCode.emit({ + totpCode: this.totpCode, + totpCodeFormatted: this.totpCodeFormatted, + }); } else { this.totpCodeFormatted = this.totpCode; } } else { this.totpCodeFormatted = null; - this.sendCopyCode.emit(this.totpCodeFormatted); + this.sendCopyCode.emit({ totpCode: null, totpCodeFormatted: null }); this.clearTotp(); } }