From c621d90e79ca205522bdf174d4ecb1e57a5a3ab1 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 23 May 2024 08:47:50 +0000 Subject: [PATCH] Bug 36940: Resolve two warnings on undefined branchip If you enabled AutoLocation and have a branch without ip, this triggers warnings. Test plan: Check logs in this situation with/without this patch by logging out and in again on staff. Signed-off-by: Marcel de Rooy Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize (cherry picked from commit 2f1ffbc6ec088c6c18bad967086db1e51084403f) Signed-off-by: Lucas Gass (cherry picked from commit 2d4537ba124d40201a4a0d164e714479474749ce) Signed-off-by: Fridolin Somers --- C4/Auth.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index c65ea3a714..2ed67391f9 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -1198,10 +1198,10 @@ sub checkauth { my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search->as_list }; if ( C4::Context->preference('StaffLoginRestrictLibraryByIP') ) { # we have to check they are coming from the right ip range - my $domain = $branches->{$branchcode}->{'branchip'}; + my $domain = $branches->{$branchcode}->{'branchip'} // q{}; $domain =~ s|\.\*||g; $domain =~ s/\s+//g; - if ( $ip !~ /^$domain/ ) { + if ( $domain && $ip !~ /^$domain/ ) { $cookie = $cookie_mgr->replace_in_list( $cookie, $query->cookie( -name => 'CGISESSID', -value => '', -- 2.39.5