rapidz / nova-2fa

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CarlosCGO/nova-google2fa

This package enforces 2FA for Laravel Nova.

Upgrade from 0.0.7 to 1.0.0

Upgrade guide is available Here.

Flow

Activation

  • User gets recovery codes.

Recovery codes

  • User activates 2FA on his device.

Activate 2FA

Verification

  • User verifies login with 2FA.

Enter 2FA

Recovery

  • If user enters invalid code, recovery button is shown.

Enter 2FA

  • User enters recovery code.

Enter 2FA

  • User is redirected to activation process.

Installation

Install via composer

$ composer require carloscgo/nova-google2fa

Publish config and migrations

$ php artisan vendor:publish --provider="CarlosCGO\Google2fa\ToolServiceProvider"

Run migrations

$ php artisan migrate

Add relation to User model

use CarlosCGO\Google2fa\Models\User2fa;

...

/**
 * @return HasOne
 */
public function user2fa(): HasOne
{
    return $this->hasOne(User2fa::class);
}

Add middleware to nova.config.

[
    ...
    'middleware' => [
        ...
        \CarlosCGO\Google2fa\Http\Middleware\Google2fa::class,
        ...
    ],
]

Security

If you discover any security-related issues, please email the author instead of using the issue tracker.

Credits

License

MIT license. Please see the license file for more information.

About


Languages

Language:PHP 57.8%Language:HTML 42.2%