https://github.com/nojimage/cakephp-login-attempts
LoginAttempts plugin for CakePHP
https://github.com/nojimage/cakephp-login-attempts
authenticate authentication cakephp cakephp-plugin loginattempts-plugin
Last synced: about 1 month ago
JSON representation
LoginAttempts plugin for CakePHP
- Host: GitHub
- URL: https://github.com/nojimage/cakephp-login-attempts
- Owner: nojimage
- License: mit
- Created: 2017-06-12T04:10:49.000Z (almost 9 years ago)
- Default Branch: cake5
- Last Pushed: 2025-06-09T07:21:12.000Z (9 months ago)
- Last Synced: 2026-02-02T23:40:11.419Z (about 1 month ago)
- Topics: authenticate, authentication, cakephp, cakephp-plugin, loginattempts-plugin
- Language: PHP
- Homepage:
- Size: 84 KB
- Stars: 6
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.ja.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# LoginAttempts plugin for CakePHP
このプラグインは、フォームログインの失敗を検知して一定期間内に同一IPから複数回のログイン失敗が発生した場合、以降のログイン処理をブロックします。
## 必要要件
- CakePHP >= 5.0
- [CakePHP Authentication plugin](https://github.com/cakephp/authentication)
## インストール
[composer](http://getcomposer.org) を使用してインストールできます。
以下のようにして、Composer経由でプラグインをCakePHPアプリケーションへ追加します:
```
composer require nojimage/cakephp-login-attempts:^3.0
```
### プラグインのロード
アプリケーションの `src/Application.php` に、次の行を追加してプラグインをロードします:
```
$this->addPlugin('LoginAttempts');
```
### テーブルの作成
マイグレーションを実行し、データベースへ必要なテーブルを作成します:
```
bin/cake migrations migrate -p LoginAttempts
```
### 使用方法
`Form` 認証機能の代わりに `LoginAttempts.Form` を使用してください。
Authentication プラグインを使う場合:
```
$service->loadAuthenticator('LoginAttempts.Form', [
'fields' => ['username' => 'email'],
'attemptLimit' => 5,
'attemptDuration' => '+5 minutes',
]);
```
### LoginAttempts.Form のオプション
#### `attemptLimit`
`attemptDuration` の間にログイン失敗回数が `attemptLimit` を超えた場合、ログインを許可しません。
default: `5`
#### `attemptDuration`
`attemptDuration` の間にログイン失敗回数が `attemptLimit` を超えた場合、ログインを許可しません。
default: `'+5 minutes'`
#### `attemptAction`
試行回数はこのキー別に保存されます。ログインフォームが複数あり、それぞれ別個に制限を設けたい場合に使用します。
default: `'login'`
#### `attemptsStorageModel`
ログインの失敗回数を記録およびチェックするためのモデルを指定します。
default: `'LoginAttempts.Attempts'`