What's working:
- The plugin has its own self‑contained TOTP library – no external dependencies.
- There's an admin page where each user can generate a secret, scan a QR code, and enable/disable 2FA for their account.
- The secret is generated using a cryptographically secure random source, so it's unique per user (no weird global salts needed – each user gets their own base32 secret).
- If you submit a TOTP code, the plugin verifies it correctly against that stored secret.
Where it falls apart:
Bludit's authentication flow creates the session the instant your password is verified. There is no hook between “password correct” and “session created” – the login just finishes before any plugin can intervene. Every attempt I made to block the admin pages after login ended up either:
- Letting you bypass the 2FA entirely (opening a new tab while sitting on the 2FA prompt would show you already logged in), or
- Getting stuck in a loop between the 2FA code and the login form, or
- Breaking the session/cookie handling in weird ways.
What's left:
The plugin still needs some UI polish to look like the polished 2FA plugins you see in other CMSes, but the core logic (secret generation, QR codes, code verification) is there. If anyone wants to take a stab at it – or if a future version of Bludit adds the right hook – all the guts seem to be there for the most part.
Happy to share the code if there's interest. It's a good starting point, just can't cross the finish line without some core modifications.

