Skip to content

♻️ MFA: send email code only when chosen, skip admin lockout outside prod - #140

Merged
Logan2234 merged 1 commit into
mainfrom
main-quick-fixes
Aug 26, 2026
Merged

♻️ MFA: send email code only when chosen, skip admin lockout outside prod#140
Logan2234 merged 1 commit into
mainfrom
main-quick-fixes

Conversation

@Logan2234

Copy link
Copy Markdown
Owner

Summary

Two follow-ups on the MFA feature (#139):

  • The login MFA-challenge email code is no longer sent eagerly for accounts with both TOTP and email enabled — it's only sent when email is the sole method, or once the user explicitly picks "Code par email" at the method-choice step. Avoids burning a send against the transactional email quota for a code the user might not use.
  • The admin /admin MFA lockout (LK-C17) is now skipped outside NODE_ENV=productionGET /api/config exposes a new adminMfaEnforced flag so the web app's own lockout screen stays consistent with what the API actually allows.

Test plan

  • pnpm build:package
  • apps/api typecheck (tsc --noEmit) — clean
  • Unit tests — not re-run for this small follow-up per explicit instruction; covered by the updated specs (auth.service.spec.ts, admin.guard.spec.ts, public-config.controller.spec.ts)

🤖 Generated with Claude Code

…ut outside prod

Previously the email code was sent as soon as a login hit the MFA step, even
when the user might pick TOTP instead — wasteful against Brevo's 300/day
quota. Now it's only sent when email is the sole enabled method, or once the
user actually picks "email" at the method-choice screen.

Also skips the admin /admin MFA lockout (LK-C17) outside NODE_ENV=production
— requiring TOTP/email setup just to reach the admin panel in dev/staging
added friction with no real security benefit there. GET /api/config now
exposes adminMfaEnforced so the web app's lockout screen matches what the
API actually allows.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions github-actions Bot added api apps/api (NestJS) web apps/web (SvelteKit) shared packages/shared labels Aug 26, 2026
@Logan2234
Logan2234 merged commit 571192b into main Aug 26, 2026
10 of 12 checks passed
@Logan2234
Logan2234 deleted the main-quick-fixes branch August 26, 2026 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api apps/api (NestJS) shared packages/shared web apps/web (SvelteKit)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant