Package

Visanduma Nova Two Factor

Nova Two Factor Authentication

Package

visanduma/nova-two-factor

View on GitHub →

Nova-Two-Factor

Laravel nova in-dashboard 2FA security feature.

What's New

v2.2.3

  • Fixed foreign key issue (need to run migration)
  • Translation fixes

v2.2.2

  • Clear option for current Two FA settings

v2.2.0

  • Reauthorize any routes using 2FA Prompt dialog.

Interface

Setup 2FA

Enable/Disable feature

Nova login screen with 2FA security

Reauthorize any route using 2FA prompt

Install the package

composer require visanduma/nova-two-factor

  1. Pubish config & migration

php artisan vendor:publish --provider="Visanduma\NovaTwoFactor\ToolServiceProvider"

Change configs as your needs

 
return [
 
// enable or disable 2FA feature. default is enabled
'enabled' => env('NOVA_TWO_FA_ENABLE',true),
 
// name of authenticatable entity table. usually - users
'user_table' => 'users',
 
// Entity primary key
'user_id_column' => 'id',
 
// authenticatable model class
'user_model' => \App\Models\User::class
 
/* Change visibility of Nova Two Fa menu in right sidebar */
'showin_sidebar' => true,
 
'menu_text' => 'Two FA',
 
'menu_icon' => 'lock-closed',
 
/* Exclude any routes from 2fa security */
'except_routes' => [
//
],
 
/**
* reauthorize these urls before access, withing given timeout
* you are allowed to use wildcards pattern for url matching
**/
 
'reauthorize_urls' => [
// 'nova/resources/users/new',
// 'nova/resources/users/*/edit',
],
 
/* timeout in minutes */
 
'reauthorize_timeout' => 5,
 
];
  1. Use ProtectWith2FA trait in configured model
<?php
 
namespace App\Models;
 
use Visanduma\NovaTwoFactor\ProtectWith2FA;
 
class User extends Authenticatable{
 
use ProtectWith2FA;
}
  1. Add TwoFa middleware to nova config file
/*
|--------------------------------------------------------------------------
| Nova Route Middleware
|--------------------------------------------------------------------------
|
| These middleware will be assigned to every Nova route, giving you the
| chance to add your own middleware to this stack or override any of
| the existing middleware. Or, you can just stick with this stack.
|
*/
 
'middleware' => [
...
\Visanduma\NovaTwoFactor\Http\Middleware\TwoFa::class
],
  1. Register NovaTwoFactor tool in Nova Service Provider
<?php
 
class NovaServiceProvider extends NovaApplicationServiceProvider{
 
public function tools()
{
return [
...
new \Visanduma\NovaTwoFactor\NovaTwoFactor()
 
];
}
 
}
  1. Run php artisan migrate
  2. You are done !

Visanduma Nova Two Factor Related Articles

Auth Screens for Your Laravel Apps image

Auth Screens for Your Laravel Apps

Read article
How to override login redirects in Jetstream or Fortify image

How to override login redirects in Jetstream or Fortify

Read article
Laravel Boilerplate 7.0 image

Laravel Boilerplate 7.0

Read article
Cachet – Laravel Powered Status Pages image

Cachet – Laravel Powered Status Pages

Read article
Factory makeMany() Method in Laravel 12.52.0 image

Factory makeMany() Method in Laravel 12.52.0

Read article
Passwordless Sign-In with Fortify Two-Factor Support in Laravel image

Passwordless Sign-In with Fortify Two-Factor Support in Laravel

Read article
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
No Compromises logo

No Compromises

Joel and Aaron, the two seasoned devs from the No Compromises podcast, are now available to hire for your Laravel project. ⬧ Flat rate of $9500/mo. ⬧ No lengthy sales process. ⬧ No contracts. ⬧ 100% money back guarantee.

No Compromises
Pushsilver logo

Pushsilver

Pushsilver is simple invoicing for freelancers and small studios — send polished invoices, automate reminders, and get paid on time without the bloat.

Pushsilver
Acquaint Softtech logo

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit