|
Lines 1485-1517
sub checkpw {
Link Here
|
| 1485 |
# INTERNAL AUTH |
1485 |
# INTERNAL AUTH |
| 1486 |
my $sth = |
1486 |
my $sth = |
| 1487 |
$dbh->prepare( |
1487 |
$dbh->prepare( |
| 1488 |
"select password,cardnumber,borrowernumber,userid,firstname,surname,branchcode,flags from borrowers where userid=?" |
1488 |
"select password,cardnumber,borrowernumber,userid,firstname,surname,borrowers.branchcode,branches.branchname,flags from borrowers join branches on borrowers.branchcode=branches.branchcode where userid=?" |
| 1489 |
); |
1489 |
); |
| 1490 |
$sth->execute($userid); |
1490 |
$sth->execute($userid); |
| 1491 |
if ( $sth->rows ) { |
1491 |
if ( $sth->rows ) { |
| 1492 |
my ( $md5password, $cardnumber, $borrowernumber, $userid, $firstname, |
1492 |
my ( $md5password, $cardnumber, $borrowernumber, $userid, $firstname, |
| 1493 |
$surname, $branchcode, $flags ) |
1493 |
$surname, $branchcode, $branchname, $flags ) |
| 1494 |
= $sth->fetchrow; |
1494 |
= $sth->fetchrow; |
| 1495 |
if ( md5_base64($password) eq $md5password and $md5password ne "!") { |
1495 |
if ( md5_base64($password) eq $md5password and $md5password ne "!") { |
| 1496 |
|
1496 |
|
| 1497 |
C4::Context->set_userenv( "$borrowernumber", $userid, $cardnumber, |
1497 |
C4::Context->set_userenv( "$borrowernumber", $userid, $cardnumber, |
| 1498 |
$firstname, $surname, $branchcode, $flags ); |
1498 |
$firstname, $surname, $branchcode, $branchname, $flags ); |
| 1499 |
return 1, $cardnumber, $userid; |
1499 |
return 1, $cardnumber, $userid; |
| 1500 |
} |
1500 |
} |
| 1501 |
} |
1501 |
} |
| 1502 |
$sth = |
1502 |
$sth = |
| 1503 |
$dbh->prepare( |
1503 |
$dbh->prepare( |
| 1504 |
"select password,cardnumber,borrowernumber,userid, firstname,surname,branchcode,flags from borrowers where cardnumber=?" |
1504 |
"select password,cardnumber,borrowernumber,userid,firstname,surname,borrowers.branchcode,branches.branchname,flags from borrowers join branches on borrowers.branchcode=branches.branchcode where cardnumber=?" |
| 1505 |
); |
1505 |
); |
| 1506 |
$sth->execute($userid); |
1506 |
$sth->execute($userid); |
| 1507 |
if ( $sth->rows ) { |
1507 |
if ( $sth->rows ) { |
| 1508 |
my ( $md5password, $cardnumber, $borrowernumber, $userid, $firstname, |
1508 |
my ( $md5password, $cardnumber, $borrowernumber, $userid, $firstname, |
| 1509 |
$surname, $branchcode, $flags ) |
1509 |
$surname, $branchcode, $branchname, $flags ) |
| 1510 |
= $sth->fetchrow; |
1510 |
= $sth->fetchrow; |
| 1511 |
if ( md5_base64($password) eq $md5password ) { |
1511 |
if ( md5_base64($password) eq $md5password ) { |
| 1512 |
|
1512 |
|
| 1513 |
C4::Context->set_userenv( $borrowernumber, $userid, $cardnumber, |
1513 |
C4::Context->set_userenv( $borrowernumber, $userid, $cardnumber, |
| 1514 |
$firstname, $surname, $branchcode, $flags ); |
1514 |
$firstname, $surname, $branchcode, $branchname, $flags ); |
| 1515 |
return 1, $cardnumber, $userid; |
1515 |
return 1, $cardnumber, $userid; |
| 1516 |
} |
1516 |
} |
| 1517 |
} |
1517 |
} |
|
Lines 1520-1526
sub checkpw {
Link Here
|
| 1520 |
{ |
1520 |
{ |
| 1521 |
|
1521 |
|
| 1522 |
# Koha superuser account |
1522 |
# Koha superuser account |
| 1523 |
# C4::Context->set_userenv(0,0,C4::Context->config('user'),C4::Context->config('user'),C4::Context->config('user'),"",1); |
1523 |
# C4::Context->set_userenv(0,0,C4::Context->config('user'),C4::Context->config('user'),C4::Context->config('user'),"","",1); |
| 1524 |
return 2; |
1524 |
return 2; |
| 1525 |
} |
1525 |
} |
| 1526 |
if ( $userid && $userid eq 'demo' |
1526 |
if ( $userid && $userid eq 'demo' |