outl1ne/nova-two-factor

Nova Two Factor Authentication

dev-main 2022-10-26 11:12 UTC

This package is auto-updated.

Last update: 2024-04-26 14:13:48 UTC


README

nova-two-factor-banner.png?raw=true

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

Nova-Two-Factor

This Laravel Nova package adds 2FA support to the Nova dashboard.

Requirements

  • php: >=8.0
  • laravel/nova: ^4.15

Screenshots

Setup 2FA

screenshot

Nova login screen with 2FA security

screenshot

Installation

Install the package in a Laravel Nova project via Composer and run migrations:

# Install nova-two-factor
composer require outl1ne/nova-two-factor

# Optionally publish the configuration and edit it
php artisan vendor:publish --provider="Outl1ne\NovaTwoFactor\TwoFactorServiceProvider" --tag="config"

# Run migrations
php artisan migrate

Add the Has2FA trait to your configured User model.

<?php

namespace App\Models;

use Outl1ne\NovaTwoFactor\Has2FA;

class User extends Authenticatable {
    use Has2FA;
}

Add the TwoFa middleware to your project's Nova config file (config/nova.php).

  'middleware' => [
    // ...
    \Outl1ne\NovaTwoFactor\Http\Middleware\TwoFa::class
  ],

Register NovaTwoFactor tool in NovaServiceProvider file.

class NovaServiceProvider extends NovaApplicationServiceProvider{

public function tools()
    {
        return [
            // ...
            \Outl1ne\NovaTwoFactor\NovaTwoFactor::make()
        ];
    }

}