Two Factor Authentication via TOTP for all your Users out-of-the-box.
This packages adds a Contract to detect in a per-user basis if it should use Two Factor Authentication. It includes a custom view and a listener to handle the Two Factor authentication itself during login attempts.
It is not invasive, but you can go full manual if you want.
To use it, add the TwoFactorAuthenticatable
contract and the TwoFactorAuthentication
trait to the User model, or any other model you want to make Two Factor Authentication available.
<?php
namespace App;
use Illuminate\Foundation\Auth\User as Authenticatable;
use DarkGhostHunter\Laraguard\TwoFactorAuthentication;
use DarkGhostHunter\Laraguard\Contracts\TwoFactorAuthenticatable;
class User extends Authenticatable implements TwoFactorAuthenticatable
{
use TwoFactorAuthentication;
// ...
}
Installation per Composer:
composer require darkghosthunter/laraguard
Laraguard (GitHub) →
Laraguard Introdcutory Post (Medium) →
💵 This linked article is stuck behind Medium’s metered paywall, which may prevent you from reading it. Open the link in an incognito window to bypass Medium’s ridiculous reading limit.