@@ -, +, @@ - with userid and password - with userid and wrong password - with cardnumber and password - with cardnumber and wrong password - Run t/db_dependent/ILSDI_Services.t - all tests should pass. --- C4/ILSDI/Services.pm | 24 ++++++++++-------------- koha-tmpl/opac-tmpl/prog/en/modules/ilsdi.tt | 2 +- t/db_dependent/ILSDI_Services.t | 2 -- 3 files changed, 11 insertions(+), 17 deletions(-) --- a/C4/ILSDI/Services.pm +++ a/C4/ILSDI/Services.pm @@ -313,28 +313,24 @@ the patron. Parameters: - username (Required) - user's login identifier + user's login identifier (userid or cardnumber) - password (Required) - user's password + user's password =cut sub AuthenticatePatron { my ($cgi) = @_; - - # Check if borrower exists, using a C4::Auth function... - unless( C4::Auth::checkpw( C4::Context->dbh, $cgi->param('username'), $cgi->param('password') ) ) { + my ($status, $cardnumber, $userid) = C4::Auth::checkpw( C4::Context->dbh, $cgi->param('username'), $cgi->param('password') ); + if ( $status ) { + # Get the borrower + my $borrower = GetMember( cardnumber => $cardnumber ); + my $patron->{'id'} = $borrower->{'borrowernumber'}; + return $patron; + } + else { return { code => 'PatronNotFound' }; } - - # Get the borrower - my $borrower = GetMember( userid => $cgi->param('username') ); - - # Build the hashref - my $patron->{'id'} = $borrower->{'borrowernumber'}; - - # ... and return his ID - return $patron; } =head2 GetPatronInfo --- a/koha-tmpl/opac-tmpl/prog/en/modules/ilsdi.tt +++ a/koha-tmpl/opac-tmpl/prog/en/modules/ilsdi.tt @@ -388,7 +388,7 @@