moonshine / two-factor
Two factor authentication for MoonShine
2.0.0
2024-10-15 18:41 UTC
Requires
- php: ^8.2|^8.3
- ext-curl: *
- ext-json: *
- bacon/bacon-qr-code: ^2.0
- pragmarx/google2fa: ^7.0|^8.0
Requires (Dev)
- brianium/paratest: ^6.8
- mockery/mockery: ^1.4.4
- phpstan/phpstan: ^1.4.7
- phpunit/phpunit: ^9.5.8
Conflicts
- moonshine/moonshine: <3.0
README
Requirements
- MoonShine v3.0+
Support MoonShine versions
Installation
composer require moonshine/two-factor
php artisan migrate
Get started
Add pipe to config/moonshine.php
use MoonShine\TwoFactor\TwoFactorAuthPipe; return [ // ... 'auth' => [ // ... 'pipelines' => [ TwoFactorAuthPipe::class ], // ... ] // ... ];
or in MoonShineServiceProvider
use MoonShine\TwoFactor\TwoFactorAuthPipe; $config->authPipelines([ TwoFactorAuthPipe::class ]);
Add trait TwoFactorAuthenticatable to model or use MoonShine\TwoFactor\Models\MoonshineUser
use MoonShine\TwoFactor\Traits\TwoFactorAuthenticatable; class MoonshineUser extends Model { use TwoFactorAuthenticatable; }
We will automatically add the component to the profile page, but if you use another page, you can add it yourself.
use MoonShine\TwoFactor\ComponentSets\TwoFactor; protected function components(): iterable { return [ // ... TwoFactor::make(), ]; }