https://github.com/moonshine-software/two-factor
Two-factor auth for MoonShine
https://github.com/moonshine-software/two-factor
moonshine two-factor
Last synced: 5 months ago
JSON representation
Two-factor auth for MoonShine
- Host: GitHub
- URL: https://github.com/moonshine-software/two-factor
- Owner: moonshine-software
- License: mit
- Created: 2023-12-09T10:54:19.000Z (over 1 year ago)
- Default Branch: 2.x
- Last Pushed: 2024-12-05T18:18:36.000Z (6 months ago)
- Last Synced: 2024-12-05T19:25:29.877Z (6 months ago)
- Topics: moonshine, two-factor
- Language: PHP
- Homepage: https://moonshine-laravel.com
- Size: 28.3 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## MoonShine two-factor authentication
### Requirements
- MoonShine v3.0+
### Support MoonShine versions
| MoonShine | Layouts |
|-------------|---------|
| 2.0+ | 1.0+ |
| 3.0+ | 2.0+ |### Installation
```shell
composer require moonshine/two-factor
``````shell
php artisan migrate
```### Get started
Add pipe to config/moonshine.php
```php
use MoonShine\TwoFactor\TwoFactorAuthPipe;return [
// ...
'auth' => [
// ...
'pipelines' => [
TwoFactorAuthPipe::class
],
// ...
]
// ...
];
```or in `MoonShineServiceProvider`
```php
use MoonShine\TwoFactor\TwoFactorAuthPipe;$config->authPipelines([
TwoFactorAuthPipe::class
]);
```Add trait TwoFactorAuthenticatable to model or use MoonShine\TwoFactor\Models\MoonshineUser
```php
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.
```php
use MoonShine\TwoFactor\ComponentSets\TwoFactor;protected function components(): iterable
{
return [
// ...TwoFactor::make(),
];
}
```