From 08be489aec5a72ed2620b5c933df746113e6b30c Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 30 Jan 2020 09:27:56 +0000 Subject: [PATCH] Bug 21190: (follow-up) Save patron id in failure when available Content-Type: text/plain; charset=utf-8 The wrong password might belong to an existing user. If that is the case, we have a $patron. Note that logaction will save the object info but has no user in the context environment for a failure. Test plan: Login with good user, bad pw and bad user, bad pw. Check logviewer. Signed-off-by: Marcel de Rooy Signed-off-by: Michal Denar --- C4/Auth.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index a4e5bd85f6..d5fd6d268f 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -1867,7 +1867,7 @@ sub checkpw { if( $patron && $passwd_ok && C4::Context->preference('AuthSuccessLog') ) { logaction( 'AUTH', 'SUCCESS', $patron->id, "Valid password for $userid", $type ); } elsif( !$passwd_ok && C4::Context->preference('AuthFailureLog') ) { - logaction( 'AUTH', 'FAILURE', 0, "Wrong password for $userid", $type ); + logaction( 'AUTH', 'FAILURE', $patron ? $patron->id : 0, "Wrong password for $userid", $type ); } return @return; -- 2.11.0