Bug 23771: Don't look for patrons if we don't have a userid

While the code requires external auth to test, the change is simple enough I
think a good read would suffice

To test:
1 - You either need Shib or CAS enabled and setup
2 - Add two users with blank.null cardnumbers
3 - Lock those user accounts
    Set failedloginattempts to 1
    Try a bad login with the userid
    Or set via the DB
4 - Try a good login via the external auth
5 - Note it fails
6 - Apply patch
7 - Login now succeeds

Signed-off-by: Mike Somers - Bridgewater State University <msomers@bridgew.edu>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit c9c6dd1016)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Nick 2019-10-07 20:09:04 +00:00 committed by Fridolin Somers
parent b117a39f69
commit b3d6acc3de
1 changed files with 5 additions and 2 deletions

View File

@ -1781,8 +1781,11 @@ sub checkpw {
my $shib_login = $shib ? get_login_shib() : undef;
my @return;
my $patron = Koha::Patrons->find({ userid => $userid });
$patron = Koha::Patrons->find({ cardnumber => $userid }) unless $patron;
my $patron;
if ( defined $userid ){
$patron = Koha::Patrons->find({ userid => $userid });
$patron = Koha::Patrons->find({ cardnumber => $userid }) unless $patron;
}
my $check_internal_as_fallback = 0;
my $passwd_ok = 0;
# Note: checkpw_* routines returns: