Installation
You can install the extension via Composer using the following command:
composer require igniterlabs/ti-ext-twofactor
Run the database migrations to create the required tables:
php artisan igniter:up
SMS login codes need the SMS Notify extension, which this extension requires.
Getting started
Two-factor authentication applies to admin staff. Customer storefront login is unchanged.
Until you change the setting, enforcement is off. Staff can turn it on from My Account, and only those who have confirmed it are asked for a code after their password.
Enable it on your account
- Open My Account.
- Click Set up two-factor authentication. Enrollment and management open in a dialog.
- Click Enable two-factor authentication.
- Scan the QR code with an authenticator app, or type the setup key. The QR code is generated on your server.
- Enter a current 6-digit code and click Confirm code.
- Save the eight recovery codes. Each code works once, and they are shown only at this step.
To turn it off, enter your current password and either a current authenticator code or an unused recovery code. The disable action is hidden while a policy requires two-factor authentication for your account.
Who must enroll
Open Manage > Settings and choose Two-factor authentication. It is listed with the other extension settings.
| Mode | Who is challenged |
|---|---|
| Do not require | Only staff who have confirmed an authenticator. This is the default. |
| All staff | Every staff member, including super users. |
| Selected roles | Staff whose assigned role is one of the roles you select. A super user is included only when that role is selected. A super user with no role is left out. |
Staff who have already confirmed an authenticator are still challenged after you leave a policy or move them to a role that is not selected. Their authenticator stays in place.
A staff member who is locked out cannot open this settings screen. Another staff member who already satisfies the policy can change it.
Grace period
The grace period is shown when enforcement is All staff or Selected roles.
- Leave it empty or set it to
0. Password login still works. Standard admin pages stay blocked until two-factor authentication is confirmed. My Account stays open so they can scan the QR code and confirm a code. Logout stays available. - Set a number of days. The clock starts the first time that staff member opens the admin while the policy applies to them. Until the deadline they can use the admin as usual. A banner shows the deadline and links to My Account. After the deadline, the same lockout as a zero-day grace applies.
Leaving the policy, or moving to a role that is not selected, clears the grace clock and stops the lockout. Entering the policy again starts a new grace window.
Signing in
Password login is unchanged. When two-factor authentication is confirmed and this session has not passed the check, the next admin page redirects to Two-factor authentication.
The form accepts:
- A current authenticator code.
- An unused recovery code. The code is consumed when it succeeds.
- Email me a code, which sends the Staff login code mail template.
- Text me a code, when the staff member has a telephone on My Account.
Email and SMS share one code. It expires after 10 minutes and works once. Requesting either delivery replaces any unspent code. Each delivery can be requested once a minute. The challenge itself allows six attempts a minute.
Text me a code sends through SMS Notify. It uses the staff member’s telephone and, when they have a location, that location’s default SMS channel. If no default channel is enabled, SMS Notify reports that and no code is sent. Edit the message under Design > SMS Templates. The mail version is under Design > Mail Templates. Both templates are named Staff login code and can use {code} and {site_name}.
Impersonation skips the challenge and the lockout. API token sign-in is unchanged.
Reset a lost device
A super user can open another staff member under Manage > Staff members, click Reset two-factor authentication, and confirm in the dialog. This removes the authenticator and recovery codes. The secret is not shown. If a policy still applies, that staff member must enroll again, and a new grace window starts the next time they open the admin.