From ca6e7e6b9490f466ee3b2d8c0375a9471767a31d Mon Sep 17 00:00:00 2001 From: Ian Walls Date: Mon, 29 Aug 2011 11:38:51 -0400 Subject: [PATCH] [SIGNED-OFF] 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 Signed-off-by: Sophie Meynieux --- C4/Auth.pm | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index e360e10..b5b50f4 100755 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -820,7 +820,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.5.4