silverstripe/silverstripe-framework — pull request #2561 by TomSpeak (2013-10-17 17:46:08+00:00)
Title: BUG FailedLoginCount reset

If you fail your maximum login attempts and are locked out, further failed login attempts add to your already existing FailedLoginCount as it is only reset if you log in successfully. This means that if you're locked out, then try again, one failure will automatically lock you out again, regardless of what you set your max limit to.

Example:

>lock_out_after_incorrect_logins: 3
FailedLoginCount: 0

The user fails three login attempts.

>lock_out_after_incorrect_logins: 3
FailedLoginCount: 3

The user is now locked out.

Lockout time passes.

The user fails their 4th login.

>lock_out_after_incorrect_logins: 3
FailedLoginCount: 4

This will continue to happen until the user successfully logs in, without giving them the pre-defined amount of login attempts again due to this condition being met after every incorrect login:
```php
if($this->FailedLoginCount >= self::config()->lock_out_after_incorrect_logins) {
```

Apologies for modifying the ```$this->write()``` too, that shouldn't have been a part of this request.