From 5b006522e51ac0809cd66d5eef08865743c09d82 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 28 Apr 2017 17:14:53 -0300 Subject: [PATCH] Bug 18314: Fix reset number of login attempts on login success Signed-off-by: Nick Clemens --- C4/Auth.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 7750f01..c77f9a8 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -1813,8 +1813,12 @@ sub checkpw { if ( $return[0] == 0 ) { $patron->update({ login_attempts => $patron->login_attempts + 1 }) if $patron; - } elsif ( $return[1] == 1 ) { - $patron->update({ login_attempts => 0 })->store if $patron; + } elsif ( $return[0] == 1 ) { + if ( $patron ) { + # FIXME Koha::Object->update should return a Koha::Object to allow chaining + $patron->update({ login_attempts => 0 }); + $patron->store; + } } return @return; } -- 2.1.4