Skip to content

fix(mfa): show enrolled methods as Enabled, not Set up - #73

Merged
lakhansamani merged 2 commits into
mainfrom
fix/mfa-enrolled-methods
Aug 3, 2026
Merged

fix(mfa): show enrolled methods as Enabled, not Set up#73
lakhansamani merged 2 commits into
mainfrom
fix/mfa-enrolled-methods

Conversation

@lakhansamani

Copy link
Copy Markdown
Contributor

Problem

A user with TOTP already verified opened Manage MFA and saw Set up on the Authenticator app tile, as if nothing was enrolled — same for email/SMS OTP. Only the passkey tile ever reflected enrolment, via the passkeyRegistered boolean.

Backend was never the issue: User.enrolled_mfa_methods reports exactly what is verified, and authorizer-js already fetches it in the user fragment. The picker just had no way to receive it.

Change

  • AuthorizerMFASetup gains enrolledMethods?: string[] — takes user.enrolled_mfa_methods verbatim (totp, webauthn, email_otp, sms_otp). Every tile now computes enabled, so enrolled methods render "Enabled" / "Manage".
  • normalizeEnrolledMethods() maps webauthn onto the passkey tile key.
  • passkeyRegistered still honoured (OR'd in) — existing hosts keep working, hosts can drop their extra webauthnCredentials() call.
  • authorizer-js 3.3.0-rc.53.3.0.
  • Version 2.2.0-rc.6.

Tests

Repo had no test runner (npm test was tsc --noEmit). Added vitest + jsdom + Testing Library and src/__tests__/AuthorizerMFASetup.test.tsx (5 tests): enrolled → Enabled/Manage, nothing enrolled → Set up, deprecated passkeyRegistered path, and the webauthnpasskey mapping. Verified they fail against the pre-fix component. npm test added to CI.

Verified

npm run type-check, npm test (5/5), npm run build all pass. npm run lint is broken on main already (eslint flat-config rejects the root key in eslint.config.js) — untouched here.

Consumed by authorizerdev/authorizer web/app settings page, which is pinned to 2.2.0-rc.6.

AuthorizerMFASetup only knew about passkey enrolment, so a user with
TOTP (or email/SMS OTP) already verified saw "Set up" on every tile and
was walked into a fresh enrolment. The server exposes the truth as
User.enrolled_mfa_methods; take it as a prop and badge each tile.

passkeyRegistered stays honoured so existing hosts keep working.

Also adds vitest (no test runner existed) and bumps authorizer-js to
3.3.0.
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

size-limit report 📦

Path Size
dist/index.cjs 60.58 KB (+0.02% 🔺)
dist/index.mjs 60.22 KB (+0.03% 🔺)

@lakhansamani
lakhansamani merged commit 3e94b58 into main Aug 3, 2026
5 checks passed
@lakhansamani
lakhansamani deleted the fix/mfa-enrolled-methods branch August 3, 2026 21:31
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.

1 participant