Skip to content

fix: relabel 2FA manual secret to "Or enter manually:" and make it copyable (#1947) - #2129

Merged
yannickmonney merged 3 commits into
mainfrom
tale/xs7a9w269vkddd625a2fvv38rs896fkk
Jun 29, 2026
Merged

yannickmonney merged 3 commits into
mainfrom
tale/xs7a9w269vkddd625a2fvv38rs896fkk

Conversation

@larryro

@larryro larryro commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Resolves #1947.

  • Relabels the 2FA manual-entry secret prompt to "Or enter manually:" across all affected locales (en, de, fr).
  • Replaces the read-only <code> (select-all) block in VerifyTotpDialog with the existing CopyableField component so the secret has a one-click copy button — matching the org ID / member-credentials pattern.

Acceptance criteria

  • Label reads "Or enter manually:".
  • The secret has a working copy button.

Verification

  • bunx tsc --noEmit — clean
  • bunx oxlint --type-aware on the changed component — 0 warnings / 0 errors

@larryro

larryro commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

Desk Review — #1947 (relabel 2FA manual secret + make copyable)

Verdict: NOT READY — CHANGES REQUIRED

CI: All 42 checks green (gh pr checks — Lint, Knip, Format, Unit, Storybook, Build *, all 16 Playwright platform shards pass; "Smoke test (fork PR)" skipped as expected).
Tests run locally: bunx vitest --run --project client copyable-field → 6/6 pass. (Full client project exceeds the sandbox time budget; the changed component path is covered by the above + e2e.)

What's correct

  • VerifyTotpDialog (two-factor-section.tsx:351-357) cleanly swaps the old <code select-all> for <CopyableField value={secret} label={t('setup.manualEntry')} />, matching the established CopyableField reuse pattern (org-ID / integration fields). extractSecret edge cases and the {secret && …} guard are sound; the copy hook (use-copy.ts) logs on failure (no swallowed error), clears its timer on unmount, and never shows a false "Copied" state.
  • Label updated correctly in en/de/fr. de-CH.json intentionally not touched — it has no manualEntry override and falls back de-CH → de → en, so it shows the new label correctly. Not a gap.

Blocking

1. The second, identical 2FA secret display was left non-copyable — app/routes/2fa-enroll.tsx:212-221.
The standalone forced-enrollment wall (/2fa-enroll, verify step) renders the exact pattern this issue set out to remove:

<code className="bg-muted rounded border px-2 py-1 text-xs select-all">
  {extractSecret(step.totpURI)}
</code>

It uses the same useT('twoFactor') namespace and the same setup.manualEntry key, so the label now reads "Or enter manually:" there too — but there is no copy button. After this PR two surfaces show the same secret under the same label with divergent affordances (settings dialog = copyable, enrollment wall = select-only). The issue's goal ("make it copyable") and acceptance criterion ("the secret has a working copy button") are only half-met, on the less-used surface. This is the primary enrollment path (and the one the e2e suite drives — which is why CI stayed green despite the change).
Fix: replace the 2fa-enroll.tsx:212-221 block with <CopyableField value={extractSecret(step.totpURI)} label={t('setup.manualEntry')} />, mirroring the settings change. Note the e2e at tests/e2e/specs/auth-account.spec.ts:226 reads the secret via page.locator('code'); once the enroll page uses CopyableField (a <button>/<span>, not <code>), update that locator (e.g. read the value span / button text) or the suite will break.

Non-blocking note

NOT READY — CHANGES REQUIRED

@larryro

larryro commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

Desk Review — Issue #1947: 2FA manual secret relabel + copyable

Verdict: READY TO MERGE.

CI

gh pr checks tale/xs7a9w269vkddd625a2fvv38rs896fkk — all checks pass, zero failing or pending (Build platform, Lint, Format, Knip, Typecheck/Analyze, Smoke, and all 16 Playwright (platform N/16) shards green). The Playwright shards exercise the changed auth-account e2e spec.

Tests run locally

bunx vitest --run --config vitest.ui.config.ts copyable-field (in services/platform) → 6 passed. The CopyableField component (the reused affordance) verifies accessible-name, value rendering, and axe a11y.

Findings (both review rounds, confirmed)

  • Correctness — PASS. Both call sites replace the old <code select-all> with <CopyableField value=… label={t('setup.manualEntry')} />. Guards are sound: two-factor-section.tsx:350 renders only when secret is truthy; 2fa-enroll.tsx:211 guards on extractSecret(step.totpURI) and passes … ?? '' defensively. Copy path uses navigator.clipboard.writeText with try/catch + error toast (no silent failure).
  • Tests — PASS. The e2e change reads the secret via getByRole('button', { name: t('twoFactor.setup.manualEntry') }) (substring match against the button's aria-labelledby accessible name "Or enter manually: ") then .innerText() (returns only the secret span; the <label> is a sibling, the icon is aria-hidden) and asserts /^[A-Z2-7]+$/. Selector is unambiguous; it genuinely validates the new copyable affordance.
  • Locales — PASS. en.json ("Or enter manually:"), de.json ("Oder manuell eingeben:"), fr.json ("Ou saisir manuellement :") all updated; no stale old strings remain anywhere. de-CH.json is a sparse regional overlay (only overrides the Swiss-spelling qrInstructions) that deep-merges over base de, so it correctly inherits the updated manualEntry — not a gap.
  • Acceptance criteria — MET. Label reads "Or enter manually:"; secret has a working copy button.

Non-blocking nits (optional, not required for merge)

  1. 2fa-enroll.tsx:211 calls extractSecret(step.totpURI) twice (guard + value). Hoist to a local for DRY.
  2. CopyableField truncates the value with an ellipsis (title=value tooltip + copy is the primary path). Acceptable and consistent with the design-system component the issue asked to reuse, but if copy-failure becomes a support issue consider break-all.
  3. The branch also reformats builtin-configs/apps/issue-desk/.../desk-process.json (oxfmt only) — out of scope but harmless; Format CI is green.

READY TO MERGE

@yannickmonney
yannickmonney merged commit 5cb0ffc into main Jun 29, 2026
50 checks passed
@yannickmonney
yannickmonney deleted the tale/xs7a9w269vkddd625a2fvv38rs896fkk branch June 29, 2026 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improvement: 2FA manual secret — relabel to "Or enter manually:" and make it copyable

2 participants