Bugzilla – Attachment 131750 Details for
Bug 29957
Cookies not removed after logout
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29957: Clear cookies on logout
Bug-29957-Clear-cookies-on-logout.patch (text/plain), 4.34 KB, created by
Marcel de Rooy
on 2022-03-15 15:51:51 UTC
(
hide
)
Description:
Bug 29957: Clear cookies on logout
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2022-03-15 15:51:51 UTC
Size:
4.34 KB
patch
obsolete
>From a9aab523c86e277c46611273e4f6607823b8641f Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 27 Jan 2022 12:33:57 +0100 >Subject: [PATCH] Bug 29957: Clear cookies on logout >Content-Type: text/plain; charset=utf-8 > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Amended: Reverted the change to $cookies to minimize changes. >--- > C4/Auth.pm | 32 +++++++++++++++++++------------- > 1 file changed, 19 insertions(+), 13 deletions(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index 872d5b5365..ac4cb0ab6e 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -242,7 +242,7 @@ sub get_template_and_user { > if ($kick_out) { > $template = C4::Templates::gettemplate( 'opac-auth.tt', 'opac', > $in->{query} ); >- $cookie = $in->{query}->cookie( >+ push @$cookie, $in->{query}->cookie( > -name => 'CGISESSID', > -value => '', > -expires => '', >@@ -654,11 +654,7 @@ sub get_template_and_user { > # what to do > my $language = C4::Languages::getlanguage( $in->{'query'} ); > my $languagecookie = C4::Templates::getlanguagecookie( $in->{'query'}, $language ); >- if ( ref $cookie eq 'ARRAY' ) { >- push @{$cookie}, $languagecookie; >- } else { >- $cookie = [ $cookie, $languagecookie ]; >- } >+ push @{$cookie}, $languagecookie; > } > > return ( $template, $borrowernumber, $cookie, $flags ); >@@ -808,6 +804,15 @@ sub _timeout_syspref { > return $timeout; > } > >+sub clear_all_cookies { >+ my ( $query ) = shift; >+ my @cookies; >+ for my $cookie_name ( $query->cookie ) { >+ push @cookies, $query->cookie( -name => $cookie_name, -value => '', -expires => '', -HttpOnly => 1 ); >+ } >+ return \@cookies; >+} >+ > sub checkauth { > my $query = shift; > >@@ -844,8 +849,8 @@ sub checkauth { > my $loggedin = 0; > my %info; > my ( $userid, $cookie, $sessionID, $flags ); >+ $cookie = []; > my $logout = $query->param('logout.x'); >- > my $anon_search_history; > my $cas_ticket = ''; > # This parameter is the name of the CAS server we want to authenticate against, >@@ -867,7 +872,7 @@ sub checkauth { > if ( !$shib and defined( $ENV{'REMOTE_USER'} ) and $ENV{'REMOTE_USER'} ne '' and $userid = $ENV{'REMOTE_USER'} ) { > > # Using Basic Authentication, no cookies required >- $cookie = $query->cookie( >+ push @$cookie, $query->cookie( > -name => 'CGISESSID', > -value => '', > -expires => '', >@@ -910,6 +915,7 @@ sub checkauth { > my $shibSuccess = C4::Context->userenv->{'shibboleth'}; > $session->delete(); > $session->flush; >+ $cookie = clear_all_cookies($query); > C4::Context->_unset_userenv($sessionID); > > if ($cas and $caslogout) { >@@ -922,7 +928,7 @@ sub checkauth { > } > } else { > >- $cookie = $query->cookie( >+ push @$cookie, $query->cookie( > -name => 'CGISESSID', > -value => $session->id, > -HttpOnly => 1, >@@ -968,7 +974,7 @@ sub checkauth { > > $sessionID = $session->id; > C4::Context->_new_userenv($sessionID); >- $cookie = $query->cookie( >+ push @$cookie, $query->cookie( > -name => 'CGISESSID', > -value => $sessionID, > -HttpOnly => 1, >@@ -1168,7 +1174,7 @@ sub checkauth { > $domain =~ s|\.\*||g; > if ( $ip !~ /^$domain/ ) { > $loggedin = 0; >- $cookie = $query->cookie( >+ push @$cookie, $query->cookie( > -name => 'CGISESSID', > -value => '', > -HttpOnly => 1, >@@ -1255,8 +1261,8 @@ sub checkauth { > if ( $loggedin || $authnotrequired ) > { > # successful login >- unless ($cookie) { >- $cookie = $query->cookie( >+ unless (@$cookie) { >+ push @$cookie, $query->cookie( > -name => 'CGISESSID', > -value => '', > -HttpOnly => 1, >-- >2.20.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 29957
:
129871
|
129872
|
130005
|
130006
|
131428
|
131750
|
131751
|
131752
|
131807
|
131808
|
131809
|
131810
|
131824
|
131825
|
131826
|
131827
|
131828
|
131840
|
131841
|
131842
|
131843
|
131856
|
132045
|
132046
|
132047
|
132105
|
132106
|
132107
|
132108
|
132109
|
132110
|
132111
|
132115
|
132210
|
132211
|
132231
|
132232
|
132233
|
132234
|
132235
|
132236
|
132237
|
132238
|
132239
|
132288
|
132289
|
132290
|
132291
|
132292
|
132293
|
132294
|
132295
|
132296