|
Lines 728-734
sub checkauth {
Link Here
|
| 728 |
my $s_userid = ''; |
728 |
my $s_userid = ''; |
| 729 |
if ($session){ |
729 |
if ($session){ |
| 730 |
$s_userid = $session->param('id') // ''; |
730 |
$s_userid = $session->param('id') // ''; |
| 731 |
C4::Context::set_userenv( |
731 |
C4::Context->set_userenv( |
| 732 |
$session->param('number'), $s_userid, |
732 |
$session->param('number'), $s_userid, |
| 733 |
$session->param('cardnumber'), $session->param('firstname'), |
733 |
$session->param('cardnumber'), $session->param('firstname'), |
| 734 |
$session->param('surname'), $session->param('branch'), |
734 |
$session->param('surname'), $session->param('branch'), |
|
Lines 1042-1048
sub checkauth {
Link Here
|
| 1042 |
if ($persona){ |
1042 |
if ($persona){ |
| 1043 |
$session->param('persona',1); |
1043 |
$session->param('persona',1); |
| 1044 |
} |
1044 |
} |
| 1045 |
C4::Context::set_userenv( |
1045 |
C4::Context->set_userenv( |
| 1046 |
$session->param('number'), $session->param('id'), |
1046 |
$session->param('number'), $session->param('id'), |
| 1047 |
$session->param('cardnumber'), $session->param('firstname'), |
1047 |
$session->param('cardnumber'), $session->param('firstname'), |
| 1048 |
$session->param('surname'), $session->param('branch'), |
1048 |
$session->param('surname'), $session->param('branch'), |
|
Lines 1282-1288
sub check_api_auth {
Link Here
|
| 1282 |
my $session = get_session($sessionID); |
1282 |
my $session = get_session($sessionID); |
| 1283 |
C4::Context->_new_userenv($sessionID); |
1283 |
C4::Context->_new_userenv($sessionID); |
| 1284 |
if ($session) { |
1284 |
if ($session) { |
| 1285 |
C4::Context::set_userenv( |
1285 |
C4::Context->set_userenv( |
| 1286 |
$session->param('number'), $session->param('id'), |
1286 |
$session->param('number'), $session->param('id'), |
| 1287 |
$session->param('cardnumber'), $session->param('firstname'), |
1287 |
$session->param('cardnumber'), $session->param('firstname'), |
| 1288 |
$session->param('surname'), $session->param('branch'), |
1288 |
$session->param('surname'), $session->param('branch'), |
|
Lines 1445-1451
sub check_api_auth {
Link Here
|
| 1445 |
$session->param('ip',$session->remote_addr()); |
1445 |
$session->param('ip',$session->remote_addr()); |
| 1446 |
$session->param('lasttime',time()); |
1446 |
$session->param('lasttime',time()); |
| 1447 |
} |
1447 |
} |
| 1448 |
C4::Context::set_userenv( |
1448 |
C4::Context->set_userenv( |
| 1449 |
$session->param('number'), $session->param('id'), |
1449 |
$session->param('number'), $session->param('id'), |
| 1450 |
$session->param('cardnumber'), $session->param('firstname'), |
1450 |
$session->param('cardnumber'), $session->param('firstname'), |
| 1451 |
$session->param('surname'), $session->param('branch'), |
1451 |
$session->param('surname'), $session->param('branch'), |
|
Lines 1524-1530
sub check_cookie_auth {
Link Here
|
| 1524 |
my $session = get_session($sessionID); |
1524 |
my $session = get_session($sessionID); |
| 1525 |
C4::Context->_new_userenv($sessionID); |
1525 |
C4::Context->_new_userenv($sessionID); |
| 1526 |
if ($session) { |
1526 |
if ($session) { |
| 1527 |
C4::Context::set_userenv( |
1527 |
C4::Context->set_userenv( |
| 1528 |
$session->param('number'), $session->param('id'), |
1528 |
$session->param('number'), $session->param('id'), |
| 1529 |
$session->param('cardnumber'), $session->param('firstname'), |
1529 |
$session->param('cardnumber'), $session->param('firstname'), |
| 1530 |
$session->param('surname'), $session->param('branch'), |
1530 |
$session->param('surname'), $session->param('branch'), |
|
Lines 1663-1697
sub checkpw_internal {
Link Here
|
| 1663 |
|
1663 |
|
| 1664 |
my $sth = |
1664 |
my $sth = |
| 1665 |
$dbh->prepare( |
1665 |
$dbh->prepare( |
| 1666 |
"select password,cardnumber,borrowernumber,userid,firstname,surname,branchcode,flags from borrowers where userid=?" |
1666 |
"select password,cardnumber,borrowernumber,userid,firstname,surname,borrowers.branchcode,branches.branchname,flags from borrowers join branches on borrowers.branchcode=branches.branchcode where userid=?" |
| 1667 |
); |
1667 |
); |
| 1668 |
$sth->execute($userid); |
1668 |
$sth->execute($userid); |
| 1669 |
if ( $sth->rows ) { |
1669 |
if ( $sth->rows ) { |
| 1670 |
my ( $stored_hash, $cardnumber, $borrowernumber, $userid, $firstname, |
1670 |
my ( $stored_hash, $cardnumber, $borrowernumber, $userid, $firstname, |
| 1671 |
$surname, $branchcode, $flags ) |
1671 |
$surname, $branchcode, $branchname, $flags ) |
| 1672 |
= $sth->fetchrow; |
1672 |
= $sth->fetchrow; |
| 1673 |
|
1673 |
|
| 1674 |
if ( checkpw_hash($password, $stored_hash) ) { |
1674 |
if ( checkpw_hash($password, $stored_hash) ) { |
| 1675 |
|
1675 |
|
| 1676 |
C4::Context->set_userenv( "$borrowernumber", $userid, $cardnumber, |
1676 |
C4::Context->set_userenv( "$borrowernumber", $userid, $cardnumber, |
| 1677 |
$firstname, $surname, $branchcode, $flags ); |
1677 |
$firstname, $surname, $branchcode, $branchname, $flags ); |
| 1678 |
return 1, $cardnumber, $userid; |
1678 |
return 1, $cardnumber, $userid; |
| 1679 |
} |
1679 |
} |
| 1680 |
} |
1680 |
} |
| 1681 |
$sth = |
1681 |
$sth = |
| 1682 |
$dbh->prepare( |
1682 |
$dbh->prepare( |
| 1683 |
"select password,cardnumber,borrowernumber,userid, firstname,surname,branchcode,flags from borrowers where cardnumber=?" |
1683 |
"select password,cardnumber,borrowernumber,userid,firstname,surname,borrowers.branchcode,branches.branchname,flags from borrowers join branches on borrowers.branchcode=branches.branchcode where cardnumber=?" |
| 1684 |
); |
1684 |
); |
| 1685 |
$sth->execute($userid); |
1685 |
$sth->execute($userid); |
| 1686 |
if ( $sth->rows ) { |
1686 |
if ( $sth->rows ) { |
| 1687 |
my ( $stored_hash, $cardnumber, $borrowernumber, $userid, $firstname, |
1687 |
my ( $stored_hash, $cardnumber, $borrowernumber, $userid, $firstname, |
| 1688 |
$surname, $branchcode, $flags ) |
1688 |
$surname, $branchcode, $branchname, $flags ) |
| 1689 |
= $sth->fetchrow; |
1689 |
= $sth->fetchrow; |
| 1690 |
|
1690 |
|
| 1691 |
if ( checkpw_hash($password, $stored_hash) ) { |
1691 |
if ( checkpw_hash($password, $stored_hash) ) { |
| 1692 |
|
1692 |
|
| 1693 |
C4::Context->set_userenv( $borrowernumber, $userid, $cardnumber, |
1693 |
C4::Context->set_userenv( $borrowernumber, $userid, $cardnumber, |
| 1694 |
$firstname, $surname, $branchcode, $flags ); |
1694 |
$firstname, $surname, $branchcode, $branchname, $flags ); |
| 1695 |
return 1, $cardnumber, $userid; |
1695 |
return 1, $cardnumber, $userid; |
| 1696 |
} |
1696 |
} |
| 1697 |
} |
1697 |
} |