From 234a973574cbf8df945b9eb89966bee433c18dda Mon Sep 17 00:00:00 2001 From: Ian Walls Date: Mon, 29 Aug 2011 11:38:51 -0400 Subject: [PATCH] Bug 6804: if IndependantBranches & AutoLocation, OPAC login redirect fails AutoLocation should only apply to the staff client login, but when IndependantBranches was activated, it applied to the OPAC login, as well. Login was not prevented, but the patron was greeted with another login prompt, instead of the My Summary page. Very confusing. This patch adds a check for whether this is an OPAC login before executing the particular code that was causing this. To test: 1. Enable IndependantBranches & AutoLocation (be sure your branches have IP ranges configured!) 2. Select a staff account, and note the branch 3. Attempt to login to the staff client from within the IP range for the branch: this should work 4. Attempt to login to the staff client from outside the IP range: this should be blocked 5. Attempt to login to the OPAC from within the IP range: this should work 6. Attempt to login to the OPAC from outside the IP range: this should also work --- C4/Auth.pm | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 16e908a..00700b8 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -807,7 +807,7 @@ sub checkauth { $branchname = GetBranchName($branchcode); } my $branches = GetBranches(); - if (C4::Context->boolean_preference('IndependantBranches') && C4::Context->boolean_preference('Autolocation')){ + if (C4::Context->boolean_preference('IndependantBranches') && C4::Context->boolean_preference('Autolocation') && ($type ne 'opac') ){ # we have to check they are coming from the right ip range my $domain = $branches->{$branchcode}->{'branchip'}; if ($ip !~ /^$domain/){ -- 1.7.4.1