mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #2560 from TomSpeak/patch-2
NEW Hook for `Member::registerFailedLogin`
This commit is contained in:
commit
1895f289cc
@ -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.
|
||||||
|
Loading…
Reference in New Issue
Block a user