From 48c1fcb6b79307b853f1161560eea512b912014b 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 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 Signed-off-by: Jonathan Druart --- C4/Auth.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index e00d6216da..1f79ef6187 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -1868,7 +1868,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.20.1