Bugzilla – Attachment 167038 Details for
Bug 36665
Auto location and IP recognition
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36665: (follow-up) Wrap code block in type ne 'opac' conditional
Bug-36665-follow-up-Wrap-code-block-in-type-ne-opa.patch (text/plain), 4.84 KB, created by
Jonathan Druart
on 2024-05-22 13:18:25 UTC
(
hide
)
Description:
Bug 36665: (follow-up) Wrap code block in type ne 'opac' conditional
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2024-05-22 13:18:25 UTC
Size:
4.84 KB
patch
obsolete
>From d03dbb4a0cd634ab81fd5d16c0c453aa1b3585ce Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 21 May 2024 11:19:14 +0000 >Subject: [PATCH] Bug 36665: (follow-up) Wrap code block in type ne 'opac' > conditional > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > C4/Auth.pm | 71 +++++++++++++++++++++++++++--------------------------- > 1 file changed, 36 insertions(+), 35 deletions(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index 4b0bc1bbe75..b313687b2f0 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -1215,43 +1215,44 @@ sub checkauth { > $register_name = $register->name if ($register); > } > my $branches = { map { $_->branchcode => $_->unblessed } Koha::Libraries->search->as_list }; >- if ( $type ne 'opac' and C4::Context->preference('AutoLocation') ) { >- >- # we have to check they are coming from the right ip range >- my $domain = $branches->{$branchcode}->{'branchip'}; >- $domain =~ s|\.\*||g; >- $domain =~ s/\s+//g; >- if ( $ip !~ /^$domain/ ) { >- $cookie = $cookie_mgr->replace_in_list( $cookie, $query->cookie( >- -name => 'CGISESSID', >- -value => '', >- -HttpOnly => 1, >- -secure => ( C4::Context->https_enabled() ? 1 : 0 ), >- -sameSite => 'Lax', >- )); >- $info{'wrongip'} = 1; >- $auth_state = "failed"; >+ if ( $type ne 'opac' ) { >+ if ( C4::Context->preference('AutoLocation') ) { >+ # we have to check they are coming from the right ip range >+ my $domain = $branches->{$branchcode}->{'branchip'}; >+ $domain =~ s|\.\*||g; >+ $domain =~ s/\s+//g; >+ if ( $ip !~ /^$domain/ ) { >+ $cookie = $cookie_mgr->replace_in_list( $cookie, $query->cookie( >+ -name => 'CGISESSID', >+ -value => '', >+ -HttpOnly => 1, >+ -secure => ( C4::Context->https_enabled() ? 1 : 0 ), >+ -sameSite => 'Lax', >+ )); >+ $info{'wrongip'} = 1; >+ $auth_state = "failed"; >+ } > } >- } >- >- if ( >- ( >- !C4::Context->preference('AutoLocation') >- && C4::Context->preference('StaffLoginBranchBasedOnIP') >- ) >- || ( C4::Context->preference('AutoLocation') && $auth_state ne 'failed' ) >- ) >- { >- foreach my $br ( uniq( $branchcode, keys %$branches ) ) { >- >- # now we work with the treatment of ip >- my $domain = $branches->{$br}->{'branchip'}; >- if ( $domain && $ip =~ /^$domain/ ) { >- $branchcode = $branches->{$br}->{'branchcode'}; > >- # new op dev : add the branchname to the cookie >- $branchname = $branches->{$br}->{'branchname'}; >- last; >+ if ( >+ ( >+ !C4::Context->preference('AutoLocation') >+ && C4::Context->preference('StaffLoginBranchBasedOnIP') >+ ) >+ || ( C4::Context->preference('AutoLocation') && $auth_state ne 'failed' ) >+ ) >+ { >+ foreach my $br ( uniq( $branchcode, keys %$branches ) ) { >+ >+ # now we work with the treatment of ip >+ my $domain = $branches->{$br}->{'branchip'}; >+ if ( $domain && $ip =~ /^$domain/ ) { >+ $branchcode = $branches->{$br}->{'branchcode'}; >+ >+ # new op dev : add the branchname to the cookie >+ $branchname = $branches->{$br}->{'branchname'}; >+ last; >+ } > } > } > } >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 36665
:
166889
|
166904
|
166941
|
166963
|
166964
|
167035
|
167036
|
167037
| 167038 |
167039
|
167117