hypermetrica/nova-2fa

Nova 双因素认证

dev-master 2023-04-06 12:39 UTC

This package is auto-updated.

Last update: 2024-09-06 15:29:14 UTC


README

Laravel nova 在仪表板上的双因素认证安全特性。

  1. 发布配置 & 迁移

    php artisan vendor:publish --provider="Hypermetrica\NovaTwoFactor\ToolServiceProvider"
    
  2. 在配置的模型中使用 ProtectWith2FA 特性

    <?php
    namespace App\Models;
    

use Hypermetrica\NovaTwoFactor\ProtectWith2FA;

class User extends Authenticatable {

use ProtectWith2FA;

}


3. Add TwoFa middleware to nova config file
'middleware' => [
    ...
    \Hypermetrica\NovaTwoFactor\Http\Middleware\TwoFa::class
],

4. Register NovaTwoFactor tool in Nova Service Provider

<?php

class NovaServiceProvider extends NovaApplicationServiceProvider{

public function tools() {

    return [
        ...
        new \Hypermetrica\NovaTwoFactor\NovaTwoFactor(),
    ];
}

}


5. Run `` php artisan migrate ``
6. You are done !