定制 ghostzero/nova-two-factor 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ghostzero/nova-two-factor

Composer 安装命令:

composer require ghostzero/nova-two-factor

包简介

Nova Two Factor Authentication

README 文档

README

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

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

screenshot

Enable/Disable feature

screenshot

Nova login screen with 2FA security

screenshot

Reauthorize any route using 2FA prompt

screenshot

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 !

统计信息

  • 总下载量: 2
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 36
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-04-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固