TwoFactor Module
Two-Factor Authentication (2FA) module for CMS Made Simple by Pixel Solutions.
Features
- Multiple Authentication Methods:
- TOTP (Time-based One-Time Password) - Google Authenticator, Authy, etc.
- Email Verification - Receive codes via email
- SMS Verification - Receive codes via Twilio SMS
- Backup Codes - One-time emergency access codes
- Flexible Configuration:
- Users can enable/disable methods individually
- Choose primary authentication method
- Multiple methods can be enabled as fallback options
- Security Features:
- Intercepts login after username/password validation
- Session-based verification flow
- Audit logging for all 2FA events
- Secure code generation and validation
Installation
- Upload the module files to
modules/TwoFactor/
- Install the module from Extensions > Modules
- The module will automatically:
- Create the database table
mod_twofactor_usermeta
- Copy
admin/twofactor.php verification page
- Register the Core::LoginPost event handler
Configuration
TOTP (Authenticator App)
- Navigate to Extensions > TwoFactor
- Click "Configure" for Authenticator App
- Scan the QR code with your authenticator app
- Enter the 6-digit code to verify
Email Verification
- Click "Configure" for Email Verification
- Click "Enable Email Verification"
- Codes will be sent to your admin account email
SMS Verification (Twilio)
- Create a Twilio account and Verify Service
- Generate API Key and Secret in Twilio Console
- Enter credentials in SMS settings:
- API Key SID
- API Secret
- Verify Service SID
- Enter phone number in E.164 format (e.g., +1234567890)
- Verify the code sent to your phone
Backup Codes
- Click "Configure" for Backup Codes
- Click "Generate Backup Codes"
- Save the codes in a secure location
- Each code can only be used once
Usage
Login Flow
- Enter username and password as normal
- After successful authentication, you'll be redirected to 2FA verification
- Enter the code from your primary authentication method
- Click "Use a backup code" if you need to use an alternative method
Switching Methods
During verification, you can switch between enabled methods using the provider dropdown.
Uninstallation
The module will:
- Remove the database table
- Delete the
admin/twofactor.php file
- Remove all user 2FA settings
Requirements
- CMS Made Simple 2.x
- PHP 7.4 or higher
- For TOTP: RobThree/TwoFactorAuth library (included via Composer)
- For SMS: Twilio account with Verify API access
Support
For issues or questions, contact: magal@pixelsolutions.biz