From c9391df734b270b812b438a092f51ed2f6f824e9 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 2 Nov 2023 13:16:52 +0000 Subject: [PATCH] Bug 35231: Resolve crash on unexisting patron in Auth Test plan: Without this patch: Logout from OPAC. Crash. Try to login. Crash. With this patch: Enable login in tracking triggers. Clear lastseen. Flush memcache. Login. Check lastseen. Logout. Login. Signed-off-by: Marcel de Rooy Signed-off-by: Caroline Cyr La Rose --- C4/Auth.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index a73d0c92b6..90c028b270 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -1318,8 +1318,8 @@ sub checkauth { )); } - my $patron = Koha::Patrons->find({ userid => $userid }); - $patron->update_lastseen('login'); + my $patron = $userid ? Koha::Patrons->find({ userid => $userid }) : undef; + $patron->update_lastseen('login') if $patron; # In case, that this request was a login attempt, we want to prevent that users can repost the opac login # request. We therefore redirect the user to the requested page again without the login parameters. -- 2.34.1