moonshine/two-factor

Two factor authentication for MoonShine

1.0.4 2024-02-01 10:13 UTC

This package is auto-updated.

Last update: 2024-04-30 11:00:56 UTC


README

Requirements

  • MoonShine v2.4.0+

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
        ],
        // ...
    ]
    // ...
];

Add trait TwoFactorAuthenticatable to model or use MoonShine\TwoFactor\Models\MoonshineUser

use MoonShine\TwoFactor\Traits\TwoFactorAuthenticatable;

class MoonshineUser extends Model
{
    use TwoFactorAuthenticatable;
}

Add component to ProfilePage

use MoonShine\TwoFactor\ComponentSets\TwoFactor;

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

        TwoFactor::make(),
    ];
}