PM-11427 Copy Totp Code without space (#10800)

This commit is contained in:
Jason Ng 2024-08-30 12:27:56 -04:00 committed by GitHub
parent c0fbb5ce39
commit d9ff8b0944
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 7 deletions

View File

@ -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"

View File

@ -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;
}
}

View File

@ -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();
}
}