Register unique login attempts and get notified of suspicious attempts via email.
Via Composer
$ composer require lamalama/laravel-login-attempts
You can publish the migration with:
php artisan vendor:publish --provider="LamaLama\LoginAttempts\LoginAttemptsServiceProvider" --tag="migrations"
After publishing the migration you can create the login_attempts
table by running the migrations:
php artisan migrate
You can optionally publish the config file with:
php artisan vendor:publish --provider="LamaLama\LoginAttempts\LoginAttemptsServiceProvider" --tag="config"
Add the LamaLama\LoginAttempts\Listeners\AuthEventSubscriber
to the $subscribe
variable in the app/Providers/EventServiceProvider.php
file.
/**
* The subscriber classes to register.
*
* @var array
*/
protected $subscribe = [
'LamaLama\LoginAttempts\Listeners\AuthEventSubscriber',
];
Set the email addresses which shoud receive notifications in your .env file:
LOGIN_ATTEMPTS_EMAIL="[email protected], [email protected]"
Clear all login attempts in the database
php artisan login-attempts:clear
Clear all failed login attempts in the database
php artisan login-attempts:clear-failed
Clear all login succeeded attempts in the database
php artisan login-attempts:clear-succeeded
Please see CHANGELOG for more information on what has changed recently.
The MIT License (MIT). Please see License File for more information.