nojimage/cakephp-login-attempts

LoginAttempts plugin for CakePHP

Installs: 13 322

Dependents: 0

Suggesters: 0

Security: 0

Stars: 6

Watchers: 1

Forks: 2

Open Issues: 0

Type:cakephp-plugin

v3.1.0 2025-06-09 07:20 UTC

README

Software License Build Status Codecov Latest Stable Version

Requirements

Installation

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 plugin

Load the plugin by adding the following statement in your project's src/Application.php:

$this->addPlugin('LoginAttempts');

Create table

Run migration command:

bin/cake migrations migrate -p LoginAttempts

Usage

Use LoginAttempts.Form authenticator instead of Form.

If you are using Authentication plugin:

        $service->loadAuthenticator('LoginAttempts.Form', [
            'fields' => ['username' => 'email'],
            'attemptLimit' => 5,
            'attemptDuration' => '+5 minutes',
        ]);

LoginAttempts.Form Options

attemptLimit

If the number of login failures exceeds attemptLimit during attemptDuration, the user's login is not permitted.

default: 5

attemptDuration

If the number of login failures exceeds attemptLimit during attemptDuration, the user's login is not permitted.

default: '+5 minutes'

attemptAction

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'

attemptsStorageModel

A model used for logging login failures and checking the count of failed login attempts.

default: 'LoginAttempts.Attempts'