Two Factor Authentication

Two-Factor Authentication

Craftable Pro uses the Laravel Fortify (opens in a new tab) package to implement the backend part of the two-factor authentication.

Config

CraftablePro overrides the default Fortify config with necessary value changes. However, if you have the fortify.php config already published or plan to publish it into your project, you will have to make a few changes to make it work with CraftablePro's two-factor authentication feature.

'guard' => 'craftable-pro',
'views' => false,
'features' => [
        //Features::registration(),
        //Features::resetPasswords(),
        //Features::emailVerification(),
        //Features::updateProfileInformation(),
        //Features::updatePasswords(),
        Features::twoFactorAuthentication([
            'confirm' => true,
            'confirmPassword' => true,
            // 'window' => 0,
        ]),
    ],

Same as they are in vendor/brackets/craftable-pro/config/fortify.php

Not all the features have to be disabled, but the Fortify registration, verification and password handling have not yet been tested within CraftablePro, as it comes with its own implementations.

If the 'views' would be set to true, Fortify would register its own routes for 2FA and there would be route naming conflicts when caching routes.

Enable Two-Factor Authentication

Each CraftableProUser can only manage their own 2FA setup. Two-factor authentication is only available for classical email/password login, not for social logins, as of yet.

Open tab Security on User Profile settings page

On this page, you can change your password or manage the two-factor authentication app.

User Profile Security screen

Click on Set up authentication app

Continue with the instructions given by the setup modal.

Google Authenticator app is available for iOS on App Store (opens in a new tab) and for Android on Play Store (opens in a new tab).

💡

The Copy Key/Copy Codes (to clipboard) functionality only works over HTTPS, as it uses the Async Clipboard API (opens in a new tab).

User Profile 2FA setup modal

Confirm the setup

User Profile 2FA setup confirmation modal

Save the recovery codes

User Profile 2FA recovery codes modal

Finish

Check that the status is now displayed as Enabled.

User Profile 2FA enabled

Login with Two-Factor Authentication

If your two-factor authentication is enabled, you will be prompted for an authentication code after logging in via email/password.

Log in

User Login screen

Get a code from the authenticator app

User login 2FA

OR use recovery code

User login 2FA recovery

Manage Two-Factor Authentication

After setting up the two-factor authentication, you can edit it or remove it.

Open tab Security on User Profile settings page

On this page, you can change your password or manage the two-factor authentication app.

User Profile Security screen

Click on Manage app

Continue with the instructions given by the manage modal.

User Profile 2FA setup modal

To edit the app, click on Change app

A new QR code and recovery codes will be generated.

💡

If you don't confirm the new QR code in the next step, the old QR code will remain active.

User Profile 2FA setup modal

Confirm the change

User Profile 2FA setup confirmation modal

Save the recovery codes

User Profile 2FA recovery codes modal

Finish

Check that the status is still displayed as Enabled and that the timestamp is current.

User Profile 2FA enabled

To remove the app, click on the trash can icon

User Profile 2FA manage modal

Confirm the removal

User Profile 2FA remove modal

Finish

Check that the status is displayed as Disabled.

User Profile 2FA enabled

Require Two-Factor Authentication

You can require all users of a given role to enable the two-factor authentication in the Roles listing within the Create or Update modal.

Users with disabled two-factor authentication with given role will be prompted once every 24 hours by a modal:

User 2FA CTA modal

Users with Two-Factor Authentication

You can check and filter users by their two-factor authentication status in the Access tab in the user listing.

Users listing 2FA
Last updated on March 1, 2024