Lines 650-656
sub checkauth {
Link Here
|
650 |
# This parameter is the name of the CAS server we want to authenticate against, |
650 |
# This parameter is the name of the CAS server we want to authenticate against, |
651 |
# when using authentication against multiple CAS servers, as configured in Auth_cas_servers.yaml |
651 |
# when using authentication against multiple CAS servers, as configured in Auth_cas_servers.yaml |
652 |
my $casparam = $query->param('cas'); |
652 |
my $casparam = $query->param('cas'); |
653 |
my $q_userid = $query->param('userid'); |
653 |
my $q_userid = $query->param('userid') // ''; |
654 |
|
654 |
|
655 |
if ( $userid = $ENV{'REMOTE_USER'} ) { |
655 |
if ( $userid = $ENV{'REMOTE_USER'} ) { |
656 |
# Using Basic Authentication, no cookies required |
656 |
# Using Basic Authentication, no cookies required |
Lines 670-678
sub checkauth {
Link Here
|
670 |
my $session = get_session($sessionID); |
670 |
my $session = get_session($sessionID); |
671 |
C4::Context->_new_userenv($sessionID); |
671 |
C4::Context->_new_userenv($sessionID); |
672 |
my ($ip, $lasttime, $sessiontype); |
672 |
my ($ip, $lasttime, $sessiontype); |
673 |
my $s_userid; |
673 |
my $s_userid = ''; |
674 |
if ($session){ |
674 |
if ($session){ |
675 |
$s_userid = $session->param('id'); |
675 |
$s_userid = $session->param('id') // ''; |
676 |
C4::Context::set_userenv( |
676 |
C4::Context::set_userenv( |
677 |
$session->param('number'), $s_userid, |
677 |
$session->param('number'), $s_userid, |
678 |
$session->param('cardnumber'), $session->param('firstname'), |
678 |
$session->param('cardnumber'), $session->param('firstname'), |
Lines 690-696
sub checkauth {
Link Here
|
690 |
$userid = $s_userid; |
690 |
$userid = $s_userid; |
691 |
$sessiontype = $session->param('sessiontype') || ''; |
691 |
$sessiontype = $session->param('sessiontype') || ''; |
692 |
} |
692 |
} |
693 |
if ( ( $query->param('koha_login_context') && ($q_userid && $s_userid && $q_userid ne $s_userid) ) |
693 |
if ( ( $query->param('koha_login_context') && ($q_userid ne $s_userid) ) |
694 |
|| ( $cas && $query->param('ticket') ) ) { |
694 |
|| ( $cas && $query->param('ticket') ) ) { |
695 |
#if a user enters an id ne to the id in the current session, we need to log them in... |
695 |
#if a user enters an id ne to the id in the current session, we need to log them in... |
696 |
#first we need to clear the anonymous session... |
696 |
#first we need to clear the anonymous session... |
Lines 714-720
sub checkauth {
Link Here
|
714 |
logout_cas($query); |
714 |
logout_cas($query); |
715 |
} |
715 |
} |
716 |
} |
716 |
} |
717 |
elsif ( $lasttime && ($lasttime < time() - $timeout) ) { |
717 |
elsif ( !$lasttime || ($lasttime < time() - $timeout) ) { |
718 |
# timed logout |
718 |
# timed logout |
719 |
$info{'timed_out'} = 1; |
719 |
$info{'timed_out'} = 1; |
720 |
$session->delete() if $session; |
720 |
$session->delete() if $session; |
Lines 763-769
sub checkauth {
Link Here
|
763 |
-HttpOnly => 1 |
763 |
-HttpOnly => 1 |
764 |
); |
764 |
); |
765 |
$userid = $q_userid; |
765 |
$userid = $q_userid; |
766 |
my $pki_field = C4::Context->preference('AllowPKIAuth') // 'None'; |
766 |
my $pki_field = C4::Context->preference('AllowPKIAuth') // ''; |
767 |
if ( ( $cas && $query->param('ticket') ) |
767 |
if ( ( $cas && $query->param('ticket') ) |
768 |
|| $userid |
768 |
|| $userid |
769 |
|| $pki_field ne 'None' |
769 |
|| $pki_field ne 'None' |
Lines 838-844
sub checkauth {
Link Here
|
838 |
my $retuserid; |
838 |
my $retuserid; |
839 |
( $return, $cardnumber, $retuserid ) = |
839 |
( $return, $cardnumber, $retuserid ) = |
840 |
checkpw( $dbh, $userid, $password, $query ); |
840 |
checkpw( $dbh, $userid, $password, $query ); |
841 |
$userid = $retuserid if ( $retuserid ne '' ); |
841 |
$userid = $retuserid if ( $retuserid ); |
842 |
} |
842 |
} |
843 |
if ($return) { |
843 |
if ($return) { |
844 |
#_session_log(sprintf "%20s from %16s logged in at %30s.\n", $userid,$ENV{'REMOTE_ADDR'},(strftime '%c', localtime)); |
844 |
#_session_log(sprintf "%20s from %16s logged in at %30s.\n", $userid,$ENV{'REMOTE_ADDR'},(strftime '%c', localtime)); |
845 |
- |
|
|