From e6a870e92cbc111883b32861501710270430b909 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 5 Jun 2013 14:56:38 -0300 Subject: [PATCH] Bug 9735 - Build the cookie array correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current implementation didn't build the cookie array correctly, yielding login problems in some scenarios. Regards To+ Sponsored-by: Universidad Nacional de Córdoba http://bugs.koha-community.org/show_bug.cgi?id=6735 --- C4/Auth.pm | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index e751be1..a67cb81 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -131,10 +131,17 @@ VALUES ( ?, ?, ?, ?, ?, EOQ sub get_template_and_user { + my $in = shift; - my $template = - C4::Templates::gettemplate( $in->{'template_name'}, $in->{'type'}, $in->{'query'}, $in->{'is_plugin'} ); my ( $user, $cookie, $sessionID, $flags ); + + my $template = C4::Templates::gettemplate( + $in->{'template_name'}, + $in->{'type'}, + $in->{'query'}, + $in->{'is_plugin'} + ); + if ( $in->{'template_name'} !~m/maintenance/ ) { ( $user, $cookie, $sessionID, $flags ) = checkauth( $in->{'query'}, @@ -282,10 +289,10 @@ sub get_template_and_user { $template->param( sessionID => $sessionID ); my ($total, $pubshelves) = C4::VirtualShelves::GetSomeShelfNames(undef, 'MASTHEAD'); - $template->param( - pubshelves => $total->{pubtotal}, - pubshelvesloop => $pubshelves, - ); + $template->param( + pubshelves => $total->{pubtotal}, + pubshelvesloop => $pubshelves, + ); } # Anonymous opac search history # If opac search history is enabled and at least one search has already been performed @@ -475,7 +482,11 @@ sub get_template_and_user { # what to do my $language = C4::Templates::getlanguage($in->{'query'},$in->{'type'}); my $languagecookie = C4::Templates::getlanguagecookie($in->{'query'},$language); - $cookie = [$cookie, $languagecookie]; + if ( ref $cookie eq 'ARRAY' ) { + push @{ $cookie }, $languagecookie; + } else { + $cookie = [$cookie, $languagecookie]; + } } return ( $template, $borrowernumber, $cookie, $flags); -- 1.8.1.2