From e8287cd2f56952345be65e98fb732476b8c0b481 Mon Sep 17 00:00:00 2001 From: Thomas Speak Date: Thu, 17 Oct 2013 18:16:57 +0100 Subject: [PATCH] NEW Hook for `Member::registerFailedLogin` Adding a hook for registerFailedLogin so that it is possible to add some custom logic when a user fails to login Also rearranged the write as this function could hit the DB up to 3 times. Now it will me 0 or 1 times. --- security/Member.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/security/Member.php b/security/Member.php index e373a07d3..2ac3d9e4b 100644 --- a/security/Member.php +++ b/security/Member.php @@ -1407,14 +1407,14 @@ class Member extends DataObject implements TemplateGlobalProvider { 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 $this->FailedLoginCount = $this->FailedLoginCount + 1; - $this->write(); if($this->FailedLoginCount >= self::config()->lock_out_after_incorrect_logins) { $lockoutMins = self::config()->lock_out_delay_mins; $this->LockedOutUntil = date('Y-m-d H:i:s', time() + $lockoutMins*60); - $this->write(); } } + $this->extend('registerFailedLogin'); + $this->write(); } /**