mitydigital/statamic-two-factor
Add two-factor authentication to your Statamic control panel. This addon adds a TOTP second step to CP logins, with enrolment screens and recovery codes, so accounts stay protected even when a password is compromised. Simple to install and configure.
composer require mitydigital/statamic-two-factorphp artisan migrate if new user columns are added.php artisan config:clear locally; in production publish config before config:cache, since the addon is entirely config-driven.Where to look first
config/two-factor.php — enforcement, issuer name, TOTP window, recovery-code count, and which factors are offered.vendor/mitydigital/statamic-two-factor/src — ServiceProvider (bindings, middleware registration, routes), the CP middleware that gates the Control Panel, and the challenge/setup controllers.routes/web.php — note the challenge route name; you'll reference it in redirects and tests.First use case: enrol one super admin, verify a full logout → login → challenge → recovery-code round trip in a second browser, then turn on enforcement for editors. Don't invert that order.
Statamic::actingAs($user) will now hit the challenge middleware. Add a test helper that either uses a factory state with 2FA disabled or marks the session as verified, and use it in every existing CP feature test — otherwise a patch bump turns your suite red.^2.7 and read the changelog on each bump; 2.7.3 is a patch and is safe to take.tinker one-liner that clears the user's 2FA state) and write it into a runbook.SESSION_DRIVER=array, cookie-only setups, or multiple app servers without a shared session store will produce confusing "challenge loops".composer update.composer.json constraint before bumping Statamic — a Statamic major has historically required a matching addon release.How can I help you explore Laravel packages today?