|
Lines 154-159
sub get_template_and_user {
Link Here
|
| 154 |
|
154 |
|
| 155 |
my $in = shift; |
155 |
my $in = shift; |
| 156 |
my ( $user, $cookie, $sessionID, $flags ); |
156 |
my ( $user, $cookie, $sessionID, $flags ); |
|
|
157 |
$cookie = []; |
| 157 |
|
158 |
|
| 158 |
# Get shibboleth login attribute |
159 |
# Get shibboleth login attribute |
| 159 |
my $shib = C4::Context->config('useshibboleth') && shib_ok(); |
160 |
my $shib = C4::Context->config('useshibboleth') && shib_ok(); |
|
Lines 243-249
sub get_template_and_user {
Link Here
|
| 243 |
if ($kick_out) { |
244 |
if ($kick_out) { |
| 244 |
$template = C4::Templates::gettemplate( 'opac-auth.tt', 'opac', |
245 |
$template = C4::Templates::gettemplate( 'opac-auth.tt', 'opac', |
| 245 |
$in->{query} ); |
246 |
$in->{query} ); |
| 246 |
$cookie = $in->{query}->cookie( |
247 |
push @$cookie, $in->{query}->cookie( |
| 247 |
-name => 'CGISESSID', |
248 |
-name => 'CGISESSID', |
| 248 |
-value => '', |
249 |
-value => '', |
| 249 |
-expires => '', |
250 |
-expires => '', |
|
Lines 656-666
sub get_template_and_user {
Link Here
|
| 656 |
# what to do |
657 |
# what to do |
| 657 |
my $language = C4::Languages::getlanguage( $in->{'query'} ); |
658 |
my $language = C4::Languages::getlanguage( $in->{'query'} ); |
| 658 |
my $languagecookie = C4::Templates::getlanguagecookie( $in->{'query'}, $language ); |
659 |
my $languagecookie = C4::Templates::getlanguagecookie( $in->{'query'}, $language ); |
| 659 |
if ( ref $cookie eq 'ARRAY' ) { |
660 |
push @{$cookie}, $languagecookie; |
| 660 |
push @{$cookie}, $languagecookie; |
|
|
| 661 |
} else { |
| 662 |
$cookie = [ $cookie, $languagecookie ]; |
| 663 |
} |
| 664 |
} |
661 |
} |
| 665 |
|
662 |
|
| 666 |
return ( $template, $borrowernumber, $cookie, $flags ); |
663 |
return ( $template, $borrowernumber, $cookie, $flags ); |
|
Lines 810-815
sub _timeout_syspref {
Link Here
|
| 810 |
return $timeout; |
807 |
return $timeout; |
| 811 |
} |
808 |
} |
| 812 |
|
809 |
|
|
|
810 |
sub clear_all_cookies { |
| 811 |
my ( $query ) = shift; |
| 812 |
my @cookies; |
| 813 |
for my $cookie_name ( $query->cookie ) { |
| 814 |
push @cookies, $query->cookie( -name => $cookie_name, -value => '', -expires => '', -HttpOnly => 1 ); |
| 815 |
} |
| 816 |
return \@cookies; |
| 817 |
} |
| 818 |
|
| 813 |
sub checkauth { |
819 |
sub checkauth { |
| 814 |
my $query = shift; |
820 |
my $query = shift; |
| 815 |
|
821 |
|
|
Lines 846-851
sub checkauth {
Link Here
|
| 846 |
my $loggedin = 0; |
852 |
my $loggedin = 0; |
| 847 |
my %info; |
853 |
my %info; |
| 848 |
my ( $userid, $cookie, $sessionID, $flags ); |
854 |
my ( $userid, $cookie, $sessionID, $flags ); |
|
|
855 |
$cookie = []; |
| 849 |
my $logout = $query->param('logout.x'); |
856 |
my $logout = $query->param('logout.x'); |
| 850 |
|
857 |
|
| 851 |
my $anon_search_history; |
858 |
my $anon_search_history; |
|
Lines 869-875
sub checkauth {
Link Here
|
| 869 |
if ( !$shib and defined( $ENV{'REMOTE_USER'} ) and $ENV{'REMOTE_USER'} ne '' and $userid = $ENV{'REMOTE_USER'} ) { |
876 |
if ( !$shib and defined( $ENV{'REMOTE_USER'} ) and $ENV{'REMOTE_USER'} ne '' and $userid = $ENV{'REMOTE_USER'} ) { |
| 870 |
|
877 |
|
| 871 |
# Using Basic Authentication, no cookies required |
878 |
# Using Basic Authentication, no cookies required |
| 872 |
$cookie = $query->cookie( |
879 |
push @$cookie, $query->cookie( |
| 873 |
-name => 'CGISESSID', |
880 |
-name => 'CGISESSID', |
| 874 |
-value => '', |
881 |
-value => '', |
| 875 |
-expires => '', |
882 |
-expires => '', |
|
Lines 914-919
sub checkauth {
Link Here
|
| 914 |
my $shibSuccess = C4::Context->userenv->{'shibboleth'}; |
921 |
my $shibSuccess = C4::Context->userenv->{'shibboleth'}; |
| 915 |
$session->delete(); |
922 |
$session->delete(); |
| 916 |
$session->flush; |
923 |
$session->flush; |
|
|
924 |
$cookie = clear_all_cookies($query); |
| 917 |
C4::Context::_unset_userenv($sessionID); |
925 |
C4::Context::_unset_userenv($sessionID); |
| 918 |
$sessionID = undef; |
926 |
$sessionID = undef; |
| 919 |
|
927 |
|
|
Lines 927-933
sub checkauth {
Link Here
|
| 927 |
} |
935 |
} |
| 928 |
} else { |
936 |
} else { |
| 929 |
|
937 |
|
| 930 |
$cookie = $query->cookie( |
938 |
push @$cookie, $query->cookie( |
| 931 |
-name => 'CGISESSID', |
939 |
-name => 'CGISESSID', |
| 932 |
-value => $session->id, |
940 |
-value => $session->id, |
| 933 |
-HttpOnly => 1, |
941 |
-HttpOnly => 1, |
|
Lines 969-975
sub checkauth {
Link Here
|
| 969 |
|
977 |
|
| 970 |
$sessionID = $session->id; |
978 |
$sessionID = $session->id; |
| 971 |
C4::Context->_new_userenv($sessionID); |
979 |
C4::Context->_new_userenv($sessionID); |
| 972 |
$cookie = $query->cookie( |
980 |
push @$cookie, $query->cookie( |
| 973 |
-name => 'CGISESSID', |
981 |
-name => 'CGISESSID', |
| 974 |
-value => $sessionID, |
982 |
-value => $sessionID, |
| 975 |
-HttpOnly => 1, |
983 |
-HttpOnly => 1, |
|
Lines 1169-1175
sub checkauth {
Link Here
|
| 1169 |
$domain =~ s|\.\*||g; |
1177 |
$domain =~ s|\.\*||g; |
| 1170 |
if ( $ip !~ /^$domain/ ) { |
1178 |
if ( $ip !~ /^$domain/ ) { |
| 1171 |
$loggedin = 0; |
1179 |
$loggedin = 0; |
| 1172 |
$cookie = $query->cookie( |
1180 |
push @$cookie, $query->cookie( |
| 1173 |
-name => 'CGISESSID', |
1181 |
-name => 'CGISESSID', |
| 1174 |
-value => '', |
1182 |
-value => '', |
| 1175 |
-HttpOnly => 1, |
1183 |
-HttpOnly => 1, |
|
Lines 1257-1264
sub checkauth {
Link Here
|
| 1257 |
if ( $loggedin || $authnotrequired ) |
1265 |
if ( $loggedin || $authnotrequired ) |
| 1258 |
{ |
1266 |
{ |
| 1259 |
# successful login |
1267 |
# successful login |
| 1260 |
unless ($cookie) { |
1268 |
unless (@$cookie) { |
| 1261 |
$cookie = $query->cookie( |
1269 |
push @$cookie, $query->cookie( |
| 1262 |
-name => 'CGISESSID', |
1270 |
-name => 'CGISESSID', |
| 1263 |
-value => '', |
1271 |
-value => '', |
| 1264 |
-HttpOnly => 1, |
1272 |
-HttpOnly => 1, |