|
Lines 157-162
sub get_template_and_user {
Link Here
|
| 157 |
my ( $user, $cookie, $sessionID, $flags ); |
157 |
my ( $user, $cookie, $sessionID, $flags ); |
| 158 |
$cookie = []; |
158 |
$cookie = []; |
| 159 |
|
159 |
|
|
|
160 |
my $cookie_mgr = Koha::CookieManager->new; |
| 161 |
|
| 160 |
# Get shibboleth login attribute |
162 |
# Get shibboleth login attribute |
| 161 |
my $shib = C4::Context->config('useshibboleth') && shib_ok(); |
163 |
my $shib = C4::Context->config('useshibboleth') && shib_ok(); |
| 162 |
my $shib_login = $shib ? get_login_shib() : undef; |
164 |
my $shib_login = $shib ? get_login_shib() : undef; |
|
Lines 245-257
sub get_template_and_user {
Link Here
|
| 245 |
if ($kick_out) { |
247 |
if ($kick_out) { |
| 246 |
$template = C4::Templates::gettemplate( 'opac-auth.tt', 'opac', |
248 |
$template = C4::Templates::gettemplate( 'opac-auth.tt', 'opac', |
| 247 |
$in->{query} ); |
249 |
$in->{query} ); |
| 248 |
push @$cookie, $in->{query}->cookie( |
250 |
$cookie = $cookie_mgr->replace_in_list( $cookie, $in->{query}->cookie( |
| 249 |
-name => 'CGISESSID', |
251 |
-name => 'CGISESSID', |
| 250 |
-value => '', |
252 |
-value => '', |
| 251 |
-expires => '', |
|
|
| 252 |
-HttpOnly => 1, |
253 |
-HttpOnly => 1, |
| 253 |
-secure => ( C4::Context->https_enabled() ? 1 : 0 ), |
254 |
-secure => ( C4::Context->https_enabled() ? 1 : 0 ), |
| 254 |
); |
255 |
)); |
| 255 |
|
256 |
|
| 256 |
$template->param( |
257 |
$template->param( |
| 257 |
loginprompt => 1, |
258 |
loginprompt => 1, |
|
Lines 658-664
sub get_template_and_user {
Link Here
|
| 658 |
# what to do |
659 |
# what to do |
| 659 |
my $language = C4::Languages::getlanguage( $in->{'query'} ); |
660 |
my $language = C4::Languages::getlanguage( $in->{'query'} ); |
| 660 |
my $languagecookie = C4::Templates::getlanguagecookie( $in->{'query'}, $language ); |
661 |
my $languagecookie = C4::Templates::getlanguagecookie( $in->{'query'}, $language ); |
| 661 |
push @{$cookie}, $languagecookie; |
662 |
$cookie = $cookie_mgr->replace_in_list( $cookie, $languagecookie ); |
| 662 |
} |
663 |
} |
| 663 |
|
664 |
|
| 664 |
return ( $template, $borrowernumber, $cookie, $flags ); |
665 |
return ( $template, $borrowernumber, $cookie, $flags ); |
|
Lines 870-882
sub checkauth {
Link Here
|
| 870 |
if ( !$shib and defined( $ENV{'REMOTE_USER'} ) and $ENV{'REMOTE_USER'} ne '' and $userid = $ENV{'REMOTE_USER'} ) { |
871 |
if ( !$shib and defined( $ENV{'REMOTE_USER'} ) and $ENV{'REMOTE_USER'} ne '' and $userid = $ENV{'REMOTE_USER'} ) { |
| 871 |
|
872 |
|
| 872 |
# Using Basic Authentication, no cookies required |
873 |
# Using Basic Authentication, no cookies required |
| 873 |
push @$cookie, $query->cookie( |
874 |
$cookie = $cookie_mgr->replace_in_list( $cookie, $query->cookie( |
| 874 |
-name => 'CGISESSID', |
875 |
-name => 'CGISESSID', |
| 875 |
-value => '', |
876 |
-value => '', |
| 876 |
-expires => '', |
|
|
| 877 |
-HttpOnly => 1, |
877 |
-HttpOnly => 1, |
| 878 |
-secure => ( C4::Context->https_enabled() ? 1 : 0 ), |
878 |
-secure => ( C4::Context->https_enabled() ? 1 : 0 ), |
| 879 |
); |
879 |
)); |
| 880 |
$loggedin = 1; |
880 |
$loggedin = 1; |
| 881 |
} |
881 |
} |
| 882 |
elsif ( $emailaddress) { |
882 |
elsif ( $emailaddress) { |
|
Lines 929-940
sub checkauth {
Link Here
|
| 929 |
} |
929 |
} |
| 930 |
} else { |
930 |
} else { |
| 931 |
|
931 |
|
| 932 |
push @$cookie, $query->cookie( |
932 |
$cookie = $cookie_mgr->replace_in_list( $cookie, $query->cookie( |
| 933 |
-name => 'CGISESSID', |
933 |
-name => 'CGISESSID', |
| 934 |
-value => $session->id, |
934 |
-value => $session->id, |
| 935 |
-HttpOnly => 1, |
935 |
-HttpOnly => 1, |
| 936 |
-secure => ( C4::Context->https_enabled() ? 1 : 0 ), |
936 |
-secure => ( C4::Context->https_enabled() ? 1 : 0 ), |
| 937 |
); |
937 |
)); |
| 938 |
|
938 |
|
| 939 |
$flags = haspermission( $userid, $flagsrequired ); |
939 |
$flags = haspermission( $userid, $flagsrequired ); |
| 940 |
if ($flags) { |
940 |
if ($flags) { |
|
Lines 973-984
sub checkauth {
Link Here
|
| 973 |
|
973 |
|
| 974 |
$sessionID = $session->id; |
974 |
$sessionID = $session->id; |
| 975 |
C4::Context->_new_userenv($sessionID); |
975 |
C4::Context->_new_userenv($sessionID); |
| 976 |
push @$cookie, $query->cookie( |
976 |
$cookie = $cookie_mgr->replace_in_list( $cookie, $query->cookie( |
| 977 |
-name => 'CGISESSID', |
977 |
-name => 'CGISESSID', |
| 978 |
-value => $sessionID, |
978 |
-value => $sessionID, |
| 979 |
-HttpOnly => 1, |
979 |
-HttpOnly => 1, |
| 980 |
-secure => ( C4::Context->https_enabled() ? 1 : 0 ), |
980 |
-secure => ( C4::Context->https_enabled() ? 1 : 0 ), |
| 981 |
); |
981 |
)); |
| 982 |
my $pki_field = C4::Context->preference('AllowPKIAuth'); |
982 |
my $pki_field = C4::Context->preference('AllowPKIAuth'); |
| 983 |
if ( !defined($pki_field) ) { |
983 |
if ( !defined($pki_field) ) { |
| 984 |
print STDERR "ERROR: Missing system preference AllowPKIAuth.\n"; |
984 |
print STDERR "ERROR: Missing system preference AllowPKIAuth.\n"; |
|
Lines 1173-1184
sub checkauth {
Link Here
|
| 1173 |
$domain =~ s|\.\*||g; |
1173 |
$domain =~ s|\.\*||g; |
| 1174 |
if ( $ip !~ /^$domain/ ) { |
1174 |
if ( $ip !~ /^$domain/ ) { |
| 1175 |
$loggedin = 0; |
1175 |
$loggedin = 0; |
| 1176 |
push @$cookie, $query->cookie( |
1176 |
$cookie = $cookie_mgr->replace_in_list( $cookie, $query->cookie( |
| 1177 |
-name => 'CGISESSID', |
1177 |
-name => 'CGISESSID', |
| 1178 |
-value => '', |
1178 |
-value => '', |
| 1179 |
-HttpOnly => 1, |
1179 |
-HttpOnly => 1, |
| 1180 |
-secure => ( C4::Context->https_enabled() ? 1 : 0 ), |
1180 |
-secure => ( C4::Context->https_enabled() ? 1 : 0 ), |
| 1181 |
); |
1181 |
)); |
| 1182 |
$info{'wrongip'} = 1; |
1182 |
$info{'wrongip'} = 1; |
| 1183 |
} |
1183 |
} |
| 1184 |
} |
1184 |
} |
|
Lines 1262-1273
sub checkauth {
Link Here
|
| 1262 |
{ |
1262 |
{ |
| 1263 |
# successful login |
1263 |
# successful login |
| 1264 |
unless (@$cookie) { |
1264 |
unless (@$cookie) { |
| 1265 |
push @$cookie, $query->cookie( |
1265 |
$cookie = $cookie_mgr->replace_in_list( $cookie, $query->cookie( |
| 1266 |
-name => 'CGISESSID', |
1266 |
-name => 'CGISESSID', |
| 1267 |
-value => '', |
1267 |
-value => '', |
| 1268 |
-HttpOnly => 1, |
1268 |
-HttpOnly => 1, |
| 1269 |
-secure => ( C4::Context->https_enabled() ? 1 : 0 ), |
1269 |
-secure => ( C4::Context->https_enabled() ? 1 : 0 ), |
| 1270 |
); |
1270 |
)); |
| 1271 |
} |
1271 |
} |
| 1272 |
|
1272 |
|
| 1273 |
track_login_daily( $userid ); |
1273 |
track_login_daily( $userid ); |
| 1274 |
- |
|
|