Email Authentication (OTP)
Email Authentication is a two-factor authentication feature that requires users to enter a one-time password (OTP) sent to their registered email address after logging in with their password.
Why Two-Factor Authentication Matters
Single-factor authentication (password only) carries the following risks:
- Password leaks due to reuse across services
- Credential theft via phishing sites
- Password exposure by insiders
Authentication Flow
- The user logs in with their username and password as usual
- If the password is correct, a 6-digit one-time code is sent via email
- An OTP input screen is displayed (with a countdown timer)
- The user enters the code received by email
- If the code is correct, login is completed
Settings
| Setting | Description | Default |
|---|---|---|
| Expiration | OTP validity period | 10 minutes |
| Target Roles | User roles that require OTP | Administrator |
| Excluded Users | Specific users exempt from OTP | None |
| Max Attempts | Maximum OTP entry attempts | 3 |
| Resend Cooldown | Waiting period before OTP can be resent | 60 seconds |
Configuration
- Navigate to SentinelSecurity → Login Security → Email Authentication (OTP)
- Toggle the switch to Enabled
- Select the target roles
- Set the expiration and max attempts
- Click Save
Selecting Target Roles
Choose which roles require OTP based on your site's operational needs.
Recommended Settings
| Site Type | Recommended Target Roles |
|---|---|
| Personal Blog | Administrator only |
| Business Site | Administrator + Editor |
| E-commerce / Membership Site | Administrator only (exclude regular members) |
Email Template Customization (Pro)
The Pro version allows you to customize the subject and body of OTP notification emails.
Available Template Variables
| Variable | Content |
|---|---|
[code] | One-time password (6 digits) |
[expires_at] | Expiration date and time |
[username] | Login username |
[site_name] | Site name |
[site_url] | Site URL |
[ip_address] | Login source IP address |
[timestamp] | Login attempt date and time |
Customization Steps
- Navigate to SentinelSecurity → Email Notification Settings
- Set the email format to HTML
- Edit the subject and body using the TinyMCE editor
- Insert template variables with a single click from the buttons on the left
Security Considerations
- OTP codes are single-use. Once used, they become invalid
- Expired codes cannot be used
- Login attempts with IP address mismatches are logged
- Exceeding the maximum OTP attempts invalidates the session
Troubleshooting
OTP Email Not Received
- Verify that WordPress email sending is functioning correctly
- Check the SMTP settings used by
wp_mail() - Check whether the email is being filtered to the spam folder
- Using a plugin such as WP Mail SMTP to improve email delivery reliability is recommended
"Invalid Code" Error After Entering the Code
- Verify that you are entering the code within the validity period
- Check that there are no leading or trailing spaces in the code
- Use the resend button to request a new code and try again