• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

LifeOnScreen/nova-google2fa: This package provides Google2FA support to Laravel ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

LifeOnScreen/nova-google2fa

开源软件地址(OpenSource Url):

https://github.com/LifeOnScreen/nova-google2fa

开源编程语言(OpenSource Language):

PHP 57.2%

开源软件介绍(OpenSource Introduction):

LifeOnScreen/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 lifeonscreen/nova-google2fa

Publish config and migrations

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

Run migrations

$ php artisan migrate

Add relation to User model

use Lifeonscreen\Google2fa\Models\User2fa;

...

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

Add middleware to nova.config.

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

Config

return [
    /**
     * Disable or enable middleware.
     */
    'enabled' => env('GOOGLE_2FA_ENABLED', true),

    'models' => [
        /**
         * Change this variable to path to user model.
         */
        'user' => 'App\User',
        
        /**
         * Change this if you need a custom connector
         */
        'user2fa' => User2fa::class,
    ],
    'tables' => [
        /**
         * Table in which users are stored.
         */
        'user' => 'users',
    ],

    'recovery_codes' => [
        /**
         * Number of recovery codes that will be generated.
         */
        'count'          => 8,

        /**
         * Number of blocks in each recovery code.
         */
        'blocks'         => 3,

        /**
         * Number of characters in each block in recovery code.
         */
        'chars_in_block' => 16,

        /**
         * The following algorithms are currently supported:
         *  - PASSWORD_DEFAULT
         *  - PASSWORD_BCRYPT
         *  - PASSWORD_ARGON2I // available from php 7.2
         */
        'hashing_algorithm' => PASSWORD_BCRYPT,
    ],
];

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.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
flutter-ui-challenges/flutter_challenge_googlemaps: Use Flutter发布时间:2022-06-22
下一篇:
google_maps_webservice | Dart Package发布时间:2022-06-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap