Lines 242-248
sub get_template_and_user {
Link Here
|
242 |
if ($kick_out) { |
242 |
if ($kick_out) { |
243 |
$template = C4::Templates::gettemplate( 'opac-auth.tt', 'opac', |
243 |
$template = C4::Templates::gettemplate( 'opac-auth.tt', 'opac', |
244 |
$in->{query} ); |
244 |
$in->{query} ); |
245 |
$cookie = $in->{query}->cookie( |
245 |
push @$cookie, $in->{query}->cookie( |
246 |
-name => 'CGISESSID', |
246 |
-name => 'CGISESSID', |
247 |
-value => '', |
247 |
-value => '', |
248 |
-expires => '', |
248 |
-expires => '', |
Lines 654-664
sub get_template_and_user {
Link Here
|
654 |
# what to do |
654 |
# what to do |
655 |
my $language = C4::Languages::getlanguage( $in->{'query'} ); |
655 |
my $language = C4::Languages::getlanguage( $in->{'query'} ); |
656 |
my $languagecookie = C4::Templates::getlanguagecookie( $in->{'query'}, $language ); |
656 |
my $languagecookie = C4::Templates::getlanguagecookie( $in->{'query'}, $language ); |
657 |
if ( ref $cookie eq 'ARRAY' ) { |
657 |
push @{$cookie}, $languagecookie; |
658 |
push @{$cookie}, $languagecookie; |
|
|
659 |
} else { |
660 |
$cookie = [ $cookie, $languagecookie ]; |
661 |
} |
662 |
} |
658 |
} |
663 |
|
659 |
|
664 |
return ( $template, $borrowernumber, $cookie, $flags ); |
660 |
return ( $template, $borrowernumber, $cookie, $flags ); |
Lines 808-813
sub _timeout_syspref {
Link Here
|
808 |
return $timeout; |
804 |
return $timeout; |
809 |
} |
805 |
} |
810 |
|
806 |
|
|
|
807 |
sub clear_all_cookies { |
808 |
my ( $query ) = shift; |
809 |
my @cookies; |
810 |
for my $cookie_name ( $query->cookie ) { |
811 |
push @cookies, $query->cookie( -name => $cookie_name, -value => '', -expires => '', -HttpOnly => 1 ); |
812 |
} |
813 |
return \@cookies; |
814 |
} |
815 |
|
811 |
sub checkauth { |
816 |
sub checkauth { |
812 |
my $query = shift; |
817 |
my $query = shift; |
813 |
|
818 |
|
Lines 844-851
sub checkauth {
Link Here
|
844 |
my $loggedin = 0; |
849 |
my $loggedin = 0; |
845 |
my %info; |
850 |
my %info; |
846 |
my ( $userid, $cookie, $sessionID, $flags ); |
851 |
my ( $userid, $cookie, $sessionID, $flags ); |
|
|
852 |
$cookie = []; |
847 |
my $logout = $query->param('logout.x'); |
853 |
my $logout = $query->param('logout.x'); |
848 |
|
|
|
849 |
my $anon_search_history; |
854 |
my $anon_search_history; |
850 |
my $cas_ticket = ''; |
855 |
my $cas_ticket = ''; |
851 |
# This parameter is the name of the CAS server we want to authenticate against, |
856 |
# This parameter is the name of the CAS server we want to authenticate against, |
Lines 867-873
sub checkauth {
Link Here
|
867 |
if ( !$shib and defined( $ENV{'REMOTE_USER'} ) and $ENV{'REMOTE_USER'} ne '' and $userid = $ENV{'REMOTE_USER'} ) { |
872 |
if ( !$shib and defined( $ENV{'REMOTE_USER'} ) and $ENV{'REMOTE_USER'} ne '' and $userid = $ENV{'REMOTE_USER'} ) { |
868 |
|
873 |
|
869 |
# Using Basic Authentication, no cookies required |
874 |
# Using Basic Authentication, no cookies required |
870 |
$cookie = $query->cookie( |
875 |
push @$cookie, $query->cookie( |
871 |
-name => 'CGISESSID', |
876 |
-name => 'CGISESSID', |
872 |
-value => '', |
877 |
-value => '', |
873 |
-expires => '', |
878 |
-expires => '', |
Lines 910-915
sub checkauth {
Link Here
|
910 |
my $shibSuccess = C4::Context->userenv->{'shibboleth'}; |
915 |
my $shibSuccess = C4::Context->userenv->{'shibboleth'}; |
911 |
$session->delete(); |
916 |
$session->delete(); |
912 |
$session->flush; |
917 |
$session->flush; |
|
|
918 |
$cookie = clear_all_cookies($query); |
913 |
C4::Context->_unset_userenv($sessionID); |
919 |
C4::Context->_unset_userenv($sessionID); |
914 |
|
920 |
|
915 |
if ($cas and $caslogout) { |
921 |
if ($cas and $caslogout) { |
Lines 922-928
sub checkauth {
Link Here
|
922 |
} |
928 |
} |
923 |
} else { |
929 |
} else { |
924 |
|
930 |
|
925 |
$cookie = $query->cookie( |
931 |
push @$cookie, $query->cookie( |
926 |
-name => 'CGISESSID', |
932 |
-name => 'CGISESSID', |
927 |
-value => $session->id, |
933 |
-value => $session->id, |
928 |
-HttpOnly => 1, |
934 |
-HttpOnly => 1, |
Lines 968-974
sub checkauth {
Link Here
|
968 |
|
974 |
|
969 |
$sessionID = $session->id; |
975 |
$sessionID = $session->id; |
970 |
C4::Context->_new_userenv($sessionID); |
976 |
C4::Context->_new_userenv($sessionID); |
971 |
$cookie = $query->cookie( |
977 |
push @$cookie, $query->cookie( |
972 |
-name => 'CGISESSID', |
978 |
-name => 'CGISESSID', |
973 |
-value => $sessionID, |
979 |
-value => $sessionID, |
974 |
-HttpOnly => 1, |
980 |
-HttpOnly => 1, |
Lines 1168-1174
sub checkauth {
Link Here
|
1168 |
$domain =~ s|\.\*||g; |
1174 |
$domain =~ s|\.\*||g; |
1169 |
if ( $ip !~ /^$domain/ ) { |
1175 |
if ( $ip !~ /^$domain/ ) { |
1170 |
$loggedin = 0; |
1176 |
$loggedin = 0; |
1171 |
$cookie = $query->cookie( |
1177 |
push @$cookie, $query->cookie( |
1172 |
-name => 'CGISESSID', |
1178 |
-name => 'CGISESSID', |
1173 |
-value => '', |
1179 |
-value => '', |
1174 |
-HttpOnly => 1, |
1180 |
-HttpOnly => 1, |
Lines 1255-1262
sub checkauth {
Link Here
|
1255 |
if ( $loggedin || $authnotrequired ) |
1261 |
if ( $loggedin || $authnotrequired ) |
1256 |
{ |
1262 |
{ |
1257 |
# successful login |
1263 |
# successful login |
1258 |
unless ($cookie) { |
1264 |
unless (@$cookie) { |
1259 |
$cookie = $query->cookie( |
1265 |
push @$cookie, $query->cookie( |
1260 |
-name => 'CGISESSID', |
1266 |
-name => 'CGISESSID', |
1261 |
-value => '', |
1267 |
-value => '', |
1262 |
-HttpOnly => 1, |
1268 |
-HttpOnly => 1, |
1263 |
- |
|
|