Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PM-15591 UI is showing when mp reprompt is on #12515

Merged
merged 8 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "lit/polyfill-support.js";

import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authentication-status";
import { EVENTS, UPDATE_PASSKEYS_HEADINGS_ON_SCROLL } from "@bitwarden/common/autofill/constants";
import { CipherType } from "@bitwarden/common/vault/enums";
import { CipherRepromptType, CipherType } from "@bitwarden/common/vault/enums";

import { InlineMenuCipherData } from "../../../../background/abstractions/overlay.background";
import { InlineMenuFillTypes } from "../../../../enums/autofill-overlay.enum";
Expand Down Expand Up @@ -1163,7 +1163,7 @@ export class AutofillInlineMenuList extends AutofillInlineMenuPageElement {
}

if (cipher.login?.totpField && cipher.login?.totp) {
return this.buildTotpElement(cipher.login?.totp, cipher.login?.username);
return this.buildTotpElement(cipher.login?.totp, cipher.login?.username, cipher.reprompt);
}
const subTitleText = this.getSubTitleText(cipher);
const cipherSubtitleElement = this.buildCipherSubtitleElement(subTitleText);
Expand Down Expand Up @@ -1191,7 +1191,11 @@ export class AutofillInlineMenuList extends AutofillInlineMenuPageElement {
* @param totp - The TOTP code to display.
*/

private buildTotpElement(totpCode: string, username?: string): HTMLDivElement | null {
private buildTotpElement(
totpCode: string,
username: string,
reprompt: CipherRepromptType,
): HTMLDivElement | null {
if (!totpCode) {
return null;
}
Expand All @@ -1213,8 +1217,9 @@ export class AutofillInlineMenuList extends AutofillInlineMenuPageElement {
}

const totpCodeSpan = document.createElement("span");
totpCodeSpan.classList.add("cipher-subtitle");
totpCodeSpan.textContent = formattedTotpCode;
totpCodeSpan.classList.toggle("cipher-subtitle");
totpCodeSpan.classList.toggle("masked-totp", !!reprompt);
totpCodeSpan.textContent = reprompt ? "โ—โ—โ—โ—โ—โ—" : formattedTotpCode;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simple and neat! โœจ

totpCodeSpan.setAttribute("aria-label", this.getTranslation("totpCodeAria"));
totpCodeSpan.setAttribute("data-testid", "totp-code");
containerElement.appendChild(totpCodeSpan);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,11 @@ body * {
color: themed("mutedTextColor");
}

&.masked-totp {
font-size: 0.875rem;
letter-spacing: 0.2rem;
}

&--passkey {
display: flex;
align-content: center;
Expand Down
Loading