mercator / totp2fa
TOTP 2FA for Winter CMS backend users.
Package info
github.com/helmutkaufmann/wn-totp2fa-plugin
Type:winter-plugin
pkg:composer/mercator/totp2fa
0.9.0
2026-04-06 04:24 UTC
Requires
- php: >=8.2
- bacon/bacon-qr-code: ^3.0
- pragmarx/google2fa: ^8.0.2
- winter/wn-user-plugin: ^2.2
README
Time-based one-time password (TOTP) two-factor authentication for both backend users and frontend users.
What It Supports
- Backend user 2FA enrollment, verification, and recovery-code flow
- Frontend user 2FA enrollment, verification, and recovery-code flow
- Global enforcement middleware for authenticated backend and frontend sessions
- Configurable enforcement modes:
- backend:
off,all,roles - frontend:
off,enrolled,all
- backend:
- Admin management in Security tabs for both user types (permission-gated)
- Self-service panel for backend users on their own profile
- Admin actions:
- force reset enrollment
- invalidate active 2FA session
- regenerate recovery codes
Requirements
- Winter CMS 1.3 (Laravel 12)
- PHP >= 8.2
- Composer packages:
pragmarx/google2fabacon/bacon-qr-code
Installation
composer require mercator/totp2fa php artisan winter:up
Permissions
mercator.totp2fa.manage_settingsmercator.totp2fa.manage_backend_user_2famercator.totp2fa.manage_frontend_user_2fa
Settings
Backend Settings page:
Settings -> Security -> TOTP 2FA
Important options:
require_modefor backend users (off|all|roles)require_rolesfor role-based backend enforcementrequire_frontend_modefor frontend users (off|enrolled|all)frontend_challenge_urlfor the frontend challenge page URL (defaults to/totp2fa/challengeand may resolve to a CMS page such as/totp-challenge)
Backend users can also self-manage TOTP 2FA from:
Settings -> My Settings -> Manage TOTP 2FA
This opens the backend My Account page, where TOTP is managed inline in the Security tab.
Usage Hints
- Backend users who are required to use 2FA are redirected into enrollment or challenge automatically after login.
- Frontend users should have a dedicated challenge page that contains the
totpFrontendChallengecomponent. - If you use a custom frontend challenge CMS page, set
frontend_challenge_urlto that page URL so middleware and login redirects stay consistent. - To offer self-service management on the frontend, place the
totpFrontendManagercomponent on a CMS page such as/totp-manage. - The frontend manager can show a sign-in form when no frontend user is logged in, then continue into challenge or setup as required.
- Recovery codes are intended to be shown once immediately after enrollment or regeneration, so users should save them right away.
- Admins can manage backend users and frontend users from the backend Security tab when they have the corresponding TOTP permissions.