Part of the guide: Hardening WordPress security with AdminEase

Two-factor login adds a second step after the password: a 6 digit code from an authenticator app such as Google Authenticator, Authy or 1Password. A stolen password is then not enough to get into WordPress. This is an AdminEase Pro feature.

What this feature does

When it is on, each user can set up an authenticator app on their own profile page: they scan a QR code, confirm one code, and get 8 backup codes. From then on, a correct password leads to a second screen that asks for the code from the app, or one of the backup codes. Each code works once.

You can make it required for some roles. Users in those roles are sent to their profile page to set it up, until they have. Everyone else can choose to use it. The Users list gets a column that shows who has it on, who has not set it up, and who is required but has not set it up yet.

How to set up two-factor login in WordPress

  1. Open AdminEase › Security › Access Control. Click AdminEase in the admin menu, open the Security tab and choose Access Control.
  2. Turn on Two-Factor Login. Optionally pick Roles That Must Use It, for example Administrator. Save.
  3. Set it up on your own profile. Open Users › Profile, find Two-Factor Login, click Set up, enter your current password, scan the QR code with your app (or type the key in by hand) and enter the code from the app.
  4. Save the backup codes. They are shown once. Keep them somewhere safe: each one gets you in once if you lose your phone.
  5. Log out and back in. Test it in a private window before you rely on it.

Settings reference

SettingWhat it doesDefault
Two-Factor LoginAdds the code step after the password for every user who has set up an app.Off
Roles That Must Use It (optional)Users in these roles are sent to their profile to set it up until they have. Leave empty to make it optional for everyone.None

What happens behind the scenes

Built so nobody is locked out

The codes follow the TOTP standard (RFC 6238). The secret is stored encrypted and the backup codes are stored hashed. The code screen lasts 5 minutes and allows 5 wrong codes before you have to log in again, and too many wrong codes from one place pause new tries for a few minutes.

A user who never set up an app still logs in with a password. An administrator can turn two-factor login off for any user from that user’s profile with Turn off for this user. If you are locked out yourself, add define( 'ADMINEASE_PRO_DISABLE_TWO_FACTOR', true ); to wp-config.php to skip the code step.

Troubleshooting

The app code is always wrong

Authenticator codes depend on the time. Check that the clock on your phone is set automatically, then try again.

A user lost their phone

They can use a backup code. If they have none left, an administrator opens their profile and clicks Turn off for this user; they log in with a password and set it up again.

Two-factor login is not available

The server needs the PHP OpenSSL extension with AES-256-GCM to encrypt the secret. Ask your host to enable it.

A user cannot log in from a custom login form

Users with two-factor login must log in on the WordPress login page. The WooCommerce My Account form sends them there for the code. Application passwords and the REST API are not affected.