|
Lines 156-161
sub get_template_and_user {
Link Here
|
| 156 |
my ( $user, $cookie, $sessionID, $flags ); |
156 |
my ( $user, $cookie, $sessionID, $flags ); |
| 157 |
$cookie = []; |
157 |
$cookie = []; |
| 158 |
|
158 |
|
|
|
159 |
my $cookie_mgr = Koha::CookieManager->new; |
| 160 |
|
| 159 |
# Get shibboleth login attribute |
161 |
# Get shibboleth login attribute |
| 160 |
my $shib = C4::Context->config('useshibboleth') && shib_ok(); |
162 |
my $shib = C4::Context->config('useshibboleth') && shib_ok(); |
| 161 |
my $shib_login = $shib ? get_login_shib() : undef; |
163 |
my $shib_login = $shib ? get_login_shib() : undef; |
|
Lines 244-256
sub get_template_and_user {
Link Here
|
| 244 |
if ($kick_out) { |
246 |
if ($kick_out) { |
| 245 |
$template = C4::Templates::gettemplate( 'opac-auth.tt', 'opac', |
247 |
$template = C4::Templates::gettemplate( 'opac-auth.tt', 'opac', |
| 246 |
$in->{query} ); |
248 |
$in->{query} ); |
| 247 |
push @$cookie, $in->{query}->cookie( |
249 |
$cookie = $cookie_mgr->replace_in_list( $cookie, $in->{query}->cookie( |
| 248 |
-name => 'CGISESSID', |
250 |
-name => 'CGISESSID', |
| 249 |
-value => '', |
251 |
-value => '', |
| 250 |
-expires => '', |
|
|
| 251 |
-HttpOnly => 1, |
252 |
-HttpOnly => 1, |
| 252 |
-secure => ( C4::Context->https_enabled() ? 1 : 0 ), |
253 |
-secure => ( C4::Context->https_enabled() ? 1 : 0 ), |
| 253 |
); |
254 |
)); |
| 254 |
|
255 |
|
| 255 |
$template->param( |
256 |
$template->param( |
| 256 |
loginprompt => 1, |
257 |
loginprompt => 1, |
|
Lines 656-662
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 |
push @{$cookie}, $languagecookie; |
660 |
$cookie = $cookie_mgr->replace_in_list( $cookie, $languagecookie ); |
| 660 |
} |
661 |
} |
| 661 |
|
662 |
|
| 662 |
return ( $template, $borrowernumber, $cookie, $flags ); |
663 |
return ( $template, $borrowernumber, $cookie, $flags ); |
|
Lines 868-880
sub checkauth {
Link Here
|
| 868 |
if ( !$shib and defined( $ENV{'REMOTE_USER'} ) and $ENV{'REMOTE_USER'} ne '' and $userid = $ENV{'REMOTE_USER'} ) { |
869 |
if ( !$shib and defined( $ENV{'REMOTE_USER'} ) and $ENV{'REMOTE_USER'} ne '' and $userid = $ENV{'REMOTE_USER'} ) { |
| 869 |
|
870 |
|
| 870 |
# Using Basic Authentication, no cookies required |
871 |
# Using Basic Authentication, no cookies required |
| 871 |
push @$cookie, $query->cookie( |
872 |
$cookie = $cookie_mgr->replace_in_list( $cookie, $query->cookie( |
| 872 |
-name => 'CGISESSID', |
873 |
-name => 'CGISESSID', |
| 873 |
-value => '', |
874 |
-value => '', |
| 874 |
-expires => '', |
|
|
| 875 |
-HttpOnly => 1, |
875 |
-HttpOnly => 1, |
| 876 |
-secure => ( C4::Context->https_enabled() ? 1 : 0 ), |
876 |
-secure => ( C4::Context->https_enabled() ? 1 : 0 ), |
| 877 |
); |
877 |
)); |
| 878 |
$loggedin = 1; |
878 |
$loggedin = 1; |
| 879 |
} |
879 |
} |
| 880 |
elsif ( $emailaddress) { |
880 |
elsif ( $emailaddress) { |
|
Lines 924-935
sub checkauth {
Link Here
|
| 924 |
} |
924 |
} |
| 925 |
} else { |
925 |
} else { |
| 926 |
|
926 |
|
| 927 |
push @$cookie, $query->cookie( |
927 |
$cookie = $cookie_mgr->replace_in_list( $cookie, $query->cookie( |
| 928 |
-name => 'CGISESSID', |
928 |
-name => 'CGISESSID', |
| 929 |
-value => $session->id, |
929 |
-value => $session->id, |
| 930 |
-HttpOnly => 1, |
930 |
-HttpOnly => 1, |
| 931 |
-secure => ( C4::Context->https_enabled() ? 1 : 0 ), |
931 |
-secure => ( C4::Context->https_enabled() ? 1 : 0 ), |
| 932 |
); |
932 |
)); |
| 933 |
|
933 |
|
| 934 |
my $sessiontype = $session->param('sessiontype') || ''; |
934 |
my $sessiontype = $session->param('sessiontype') || ''; |
| 935 |
unless ( $sessiontype && $sessiontype eq 'anon' ) { #if this is an anonymous session, we want to update the session, but not behave as if they are logged in... |
935 |
unless ( $sessiontype && $sessiontype eq 'anon' ) { #if this is an anonymous session, we want to update the session, but not behave as if they are logged in... |
|
Lines 970-981
sub checkauth {
Link Here
|
| 970 |
|
970 |
|
| 971 |
$sessionID = $session->id; |
971 |
$sessionID = $session->id; |
| 972 |
C4::Context->_new_userenv($sessionID); |
972 |
C4::Context->_new_userenv($sessionID); |
| 973 |
push @$cookie, $query->cookie( |
973 |
$cookie = $cookie_mgr->replace_in_list( $cookie, $query->cookie( |
| 974 |
-name => 'CGISESSID', |
974 |
-name => 'CGISESSID', |
| 975 |
-value => $sessionID, |
975 |
-value => $sessionID, |
| 976 |
-HttpOnly => 1, |
976 |
-HttpOnly => 1, |
| 977 |
-secure => ( C4::Context->https_enabled() ? 1 : 0 ), |
977 |
-secure => ( C4::Context->https_enabled() ? 1 : 0 ), |
| 978 |
); |
978 |
)); |
| 979 |
my $pki_field = C4::Context->preference('AllowPKIAuth'); |
979 |
my $pki_field = C4::Context->preference('AllowPKIAuth'); |
| 980 |
if ( !defined($pki_field) ) { |
980 |
if ( !defined($pki_field) ) { |
| 981 |
print STDERR "ERROR: Missing system preference AllowPKIAuth.\n"; |
981 |
print STDERR "ERROR: Missing system preference AllowPKIAuth.\n"; |
|
Lines 1170-1181
sub checkauth {
Link Here
|
| 1170 |
$domain =~ s|\.\*||g; |
1170 |
$domain =~ s|\.\*||g; |
| 1171 |
if ( $ip !~ /^$domain/ ) { |
1171 |
if ( $ip !~ /^$domain/ ) { |
| 1172 |
$loggedin = 0; |
1172 |
$loggedin = 0; |
| 1173 |
push @$cookie, $query->cookie( |
1173 |
$cookie = $cookie_mgr->replace_in_list( $cookie, $query->cookie( |
| 1174 |
-name => 'CGISESSID', |
1174 |
-name => 'CGISESSID', |
| 1175 |
-value => '', |
1175 |
-value => '', |
| 1176 |
-HttpOnly => 1, |
1176 |
-HttpOnly => 1, |
| 1177 |
-secure => ( C4::Context->https_enabled() ? 1 : 0 ), |
1177 |
-secure => ( C4::Context->https_enabled() ? 1 : 0 ), |
| 1178 |
); |
1178 |
)); |
| 1179 |
$info{'wrongip'} = 1; |
1179 |
$info{'wrongip'} = 1; |
| 1180 |
} |
1180 |
} |
| 1181 |
} |
1181 |
} |
|
Lines 1258-1269
sub checkauth {
Link Here
|
| 1258 |
{ |
1258 |
{ |
| 1259 |
# successful login |
1259 |
# successful login |
| 1260 |
unless (@$cookie) { |
1260 |
unless (@$cookie) { |
| 1261 |
push @$cookie, $query->cookie( |
1261 |
$cookie = $cookie_mgr->replace_in_list( $cookie, $query->cookie( |
| 1262 |
-name => 'CGISESSID', |
1262 |
-name => 'CGISESSID', |
| 1263 |
-value => '', |
1263 |
-value => '', |
| 1264 |
-HttpOnly => 1, |
1264 |
-HttpOnly => 1, |
| 1265 |
-secure => ( C4::Context->https_enabled() ? 1 : 0 ), |
1265 |
-secure => ( C4::Context->https_enabled() ? 1 : 0 ), |
| 1266 |
); |
1266 |
)); |
| 1267 |
} |
1267 |
} |
| 1268 |
|
1268 |
|
| 1269 |
track_login_daily( $userid ); |
1269 |
track_login_daily( $userid ); |
| 1270 |
- |
|
|