|
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') // ''; |
766 |
my $pki_field = C4::Context->preference('AllowPKIAuth'); |
|
|
767 |
if (!defined($pki_field)) { |
| 768 |
print STDERR "Error: Missing AllowPKIAuth System Preference!\n"; |
| 769 |
$pki_field = ''; |
| 770 |
} |
| 767 |
if ( ( $cas && $query->param('ticket') ) |
771 |
if ( ( $cas && $query->param('ticket') ) |
| 768 |
|| $userid |
772 |
|| $userid |
| 769 |
|| $pki_field ne 'None' |
773 |
|| $pki_field ne 'None' |
|
Lines 780-807
sub checkauth {
Link Here
|
| 780 |
$info{'invalidCasLogin'} = 1 unless ($return); |
784 |
$info{'invalidCasLogin'} = 1 unless ($return); |
| 781 |
} |
785 |
} |
| 782 |
|
786 |
|
| 783 |
elsif ($persona) { |
787 |
elsif ($persona) { |
| 784 |
my $value = $persona; |
788 |
my $value = $persona; |
| 785 |
|
789 |
|
| 786 |
# If we're looking up the email, there's a chance that the person |
790 |
# If we're looking up the email, there's a chance that the person |
| 787 |
# doesn't have a userid. So if there is none, we pass along the |
791 |
# doesn't have a userid. So if there is none, we pass along the |
| 788 |
# borrower number, and the bits of code that need to know the user |
792 |
# borrower number, and the bits of code that need to know the user |
| 789 |
# ID will have to be smart enough to handle that. |
793 |
# ID will have to be smart enough to handle that. |
| 790 |
require C4::Members; |
794 |
require C4::Members; |
| 791 |
my @users_info = C4::Members::GetBorrowersWithEmail($value); |
795 |
my @users_info = C4::Members::GetBorrowersWithEmail($value); |
| 792 |
if (@users_info) { |
796 |
if (@users_info) { |
| 793 |
|
797 |
|
| 794 |
# First the userid, then the borrowernum |
798 |
# First the userid, then the borrowernum |
| 795 |
$value = $users_info[0][1] || $users_info[0][0]; |
799 |
$value = $users_info[0][1] || $users_info[0][0]; |
| 796 |
} |
800 |
} |
| 797 |
else { |
801 |
else { |
| 798 |
undef $value; |
802 |
undef $value; |
| 799 |
} |
803 |
} |
| 800 |
$return = $value ? 1 : 0; |
804 |
$return = $value ? 1 : 0; |
| 801 |
$userid = $value; |
805 |
$userid = $value; |
| 802 |
} |
806 |
} |
| 803 |
|
807 |
|
| 804 |
elsif ( |
808 |
elsif ( |
| 805 |
( $pki_field eq 'Common Name' && $ENV{'SSL_CLIENT_S_DN_CN'} ) |
809 |
( $pki_field eq 'Common Name' && $ENV{'SSL_CLIENT_S_DN_CN'} ) |
| 806 |
|| ( $pki_field eq 'emailAddress' |
810 |
|| ( $pki_field eq 'emailAddress' |
| 807 |
&& $ENV{'SSL_CLIENT_S_DN_Email'} ) |
811 |
&& $ENV{'SSL_CLIENT_S_DN_Email'} ) |
|
Lines 833-846
sub checkauth {
Link Here
|
| 833 |
$return = $value ? 1 : 0; |
837 |
$return = $value ? 1 : 0; |
| 834 |
$userid = $value; |
838 |
$userid = $value; |
| 835 |
|
839 |
|
| 836 |
} |
840 |
} |
| 837 |
else { |
841 |
else { |
| 838 |
my $retuserid; |
842 |
my $retuserid; |
| 839 |
( $return, $cardnumber, $retuserid ) = |
843 |
( $return, $cardnumber, $retuserid ) = |
| 840 |
checkpw( $dbh, $userid, $password, $query ); |
844 |
checkpw( $dbh, $userid, $password, $query ); |
| 841 |
$userid = $retuserid if ( $retuserid ); |
845 |
$userid = $retuserid if ( $retuserid ); |
| 842 |
} |
846 |
} |
| 843 |
if ($return) { |
847 |
if ($return) { |
| 844 |
#_session_log(sprintf "%20s from %16s logged in at %30s.\n", $userid,$ENV{'REMOTE_ADDR'},(strftime '%c', localtime)); |
848 |
#_session_log(sprintf "%20s from %16s logged in at %30s.\n", $userid,$ENV{'REMOTE_ADDR'},(strftime '%c', localtime)); |
| 845 |
if ( $flags = haspermission( $userid, $flagsrequired ) ) { |
849 |
if ( $flags = haspermission( $userid, $flagsrequired ) ) { |
| 846 |
$loggedin = 1; |
850 |
$loggedin = 1; |
| 847 |
- |
|
|