diff --git a/C4/Auth.pm b/C4/Auth.pm index 8b0b567a83..fbf3ed0513 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -1773,6 +1773,15 @@ sub check_cookie_auth { } elsif ( $userid ) { $session->param( 'lasttime', time() ); my $patron = Koha::Patrons->find({ userid => $userid }); + + # If the user modify their own userid + # Better than 500 but we could do better + unless ( $patron ) { + $session->delete(); + $session->flush; + return ("expired", undef); + } + $patron = Koha::Patrons->find({ cardnumber => $userid }) unless $patron; return ("password_expired", undef ) if $patron->password_expired;