From 16bbbd00f86ab9b4a5e13abd61474a15d70be4b3 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 --- C4/Auth.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 995772dcb2..71e1bc32ec 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -1875,7 +1875,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