Merge pull request #2560 from TomSpeak/patch-2

NEW Hook for `Member::registerFailedLogin`
This commit is contained in:
Ingo Schommer 2013-10-22 11:57:21 +02:00
commit 1895f289cc

View File

@ -227,7 +227,6 @@ class Member extends DataObject implements TemplateGlobalProvider {
$e = PasswordEncryptor::create_for_algorithm($this->PasswordEncryption); $e = PasswordEncryptor::create_for_algorithm($this->PasswordEncryption);
if(!$e->check($this->Password, $password, $this->Salt, $this)) { if(!$e->check($this->Password, $password, $this->Salt, $this)) {
$iidentifierField =
$result->error(_t ( $result->error(_t (
'Member.ERRORWRONGCREDS', 'Member.ERRORWRONGCREDS',
'The provided details don\'t seem to be correct. Please try again.' 'The provided details don\'t seem to be correct. Please try again.'
@ -1408,16 +1407,16 @@ class Member extends DataObject implements TemplateGlobalProvider {
if(self::config()->lock_out_after_incorrect_logins) { if(self::config()->lock_out_after_incorrect_logins) {
// Keep a tally of the number of failed log-ins so that we can lock people out // Keep a tally of the number of failed log-ins so that we can lock people out
$this->FailedLoginCount = $this->FailedLoginCount + 1; $this->FailedLoginCount = $this->FailedLoginCount + 1;
$this->write();
if($this->FailedLoginCount >= self::config()->lock_out_after_incorrect_logins) { if($this->FailedLoginCount >= self::config()->lock_out_after_incorrect_logins) {
$lockoutMins = self::config()->lock_out_delay_mins; $lockoutMins = self::config()->lock_out_delay_mins;
$this->LockedOutUntil = date('Y-m-d H:i:s', time() + $lockoutMins*60); $this->LockedOutUntil = date('Y-m-d H:i:s', time() + $lockoutMins*60);
$this->FailedLoginCount = 0; $this->FailedLoginCount = 0;
}
}
$this->extend('registerFailedLogin');
$this->write(); $this->write();
} }
}
}
/** /**
* Get the HtmlEditorConfig for this user to be used in the CMS. * Get the HtmlEditorConfig for this user to be used in the CMS.