moonshine / two-factor

MoonShine的二次验证

1.0.4 2024-02-01 10:13 UTC

This package is auto-updated.

Last update: 2024-08-30 11:45:47 UTC


README

要求

  • MoonShine v2.4.0+

安装

composer require moonshine/two-factor
php artisan migrate

开始使用

将管道添加到config/moonshine.php

use MoonShine\TwoFactor\TwoFactorAuthPipe;

return [
    // ...
    'auth' => [
        // ...
        'pipelines' => [
            TwoFactorAuthPipe::class
        ],
        // ...
    ]
    // ...
];

将特质TwoFactorAuthenticatable添加到模型或使用MoonShine\TwoFactor\Models\MoonshineUser

use MoonShine\TwoFactor\Traits\TwoFactorAuthenticatable;

class MoonshineUser extends Model
{
    use TwoFactorAuthenticatable;
}

将组件添加到ProfilePage

use MoonShine\TwoFactor\ComponentSets\TwoFactor;

protected function components(): array
{
    return [
        // ...

        TwoFactor::make(),
    ];
}