- CakePHP >= 5.0
- CakePHP Authentication plugin
You can install this plugin into your CakePHP application using composer.
The recommended way to install composer packages is:
composer require nojimage/cakephp-login-attempts"^3.0
Load the plugin by adding the following statement in your project's src/Application.php
:
$this->addPlugin('LoginAttempts');
run migration command:
bin/cake migrations migrate -p LoginAttempts
Use LoginAttempts.Form
authenticator instead of Form
.
If use are using Authentication plugin:
$service->loadAuthenticator('LoginAttempts.Form', [
'fields' => ['username' => 'email'],
'attemptLimit' => 5,
'attemptDuration' => '+5 minutes',
]);
If the num of login failures of the user exceeds attemptLimit
during attemptDuration
,
the user's login is not permitted.
default: 5
If the num of login failures of the user exceeds attemptLimit
during attemptDuration
,
the user's login is not permitted.
default: '+5 minutes'
The number of attempts is stored separately for this key. Use when there are multiple login forms and you want to set restrictions separately.
default: 'login'
A model used for logging a failure login and check count of failure login.
default: 'LoginAttempts.Attempts'