Lines 22-27
use warnings;
Link Here
|
22 |
|
22 |
|
23 |
use C4::Debug; |
23 |
use C4::Debug; |
24 |
use C4::Context; |
24 |
use C4::Context; |
|
|
25 |
use C4::Members qw( AddMember_Auto ); |
25 |
use Carp; |
26 |
use Carp; |
26 |
use CGI; |
27 |
use CGI; |
27 |
|
28 |
|
Lines 99-107
sub checkpw_shib {
Link Here
|
99 |
return ( 1, $retnumber, $userid ); |
100 |
return ( 1, $retnumber, $userid ); |
100 |
} |
101 |
} |
101 |
|
102 |
|
102 |
# If we reach this point, the user is not a valid koha user |
103 |
if ( $shib->{'autocreate'} ) { |
103 |
$debug and warn "User $userid is not a valid Koha user"; |
104 |
return _autocreate( $dbh, $shib, $userid ); |
104 |
return 0; |
105 |
} else { |
|
|
106 |
# If we reach this point, the user is not a valid koha user |
107 |
$debug and warn "User $userid is not a valid Koha user"; |
108 |
return 0; |
109 |
} |
110 |
} |
111 |
|
112 |
sub _autocreate { |
113 |
my ( $dbh, $shib, $userid ) = @_; |
114 |
|
115 |
my %borrower = ( userid => $userid ); |
116 |
|
117 |
while ( my ( $key, $entry ) = each %{$shib->{'mapping'}} ) { |
118 |
$borrower{$key} = ( $entry->{'is'} && $ENV{ $entry->{'is'} } ) || $entry->{'content'} || ''; |
119 |
} |
120 |
|
121 |
%borrower = AddMember_Auto( %borrower ); |
122 |
|
123 |
return ( 1, $borrower{'cardnumber'}, $borrower{'userid'} ); |
105 |
} |
124 |
} |
106 |
|
125 |
|
107 |
1; |
126 |
1; |