From a5f5b1b8f26b3272798462ee0d6624f1b5028f71 Mon Sep 17 00:00:00 2001 From: David Cook Date: Tue, 28 Nov 2023 22:57:39 +0000 Subject: [PATCH] Bug 34893: Add checkpw change to REST API This patch adds the checkpw return value change to the REST API route for validating user identifiers and password. Test plan: 0. Apply patch 1. prove t/db_dependent/api/v1/password_validation.t Bonus points: 1. koha-plack --reload kohadev 2. Enable syspref RESTBasicAuth 3. curl -XPOST -H "Content-Type: application/json" \ -u : \ -d '{"identifier":"","password":""}' \ http://localhost:8081/api/v1/auth/password/validation 4. Validation doesn't fail. It gives you cardnumber, patron_id, userid Signed-off-by: Victor Grousset/tuxayo --- Koha/REST/V1/Auth/Password.pm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Koha/REST/V1/Auth/Password.pm b/Koha/REST/V1/Auth/Password.pm index 4369ffd187..a7e04a05b2 100644 --- a/Koha/REST/V1/Auth/Password.pm +++ b/Koha/REST/V1/Auth/Password.pm @@ -71,7 +71,7 @@ sub validate { my $password = $body->{password} // ""; return try { - my ( $status, $THE_cardnumber, $THE_userid ) = C4::Auth::checkpw( $identifier, $password ); + my ( $status, $THE_cardnumber, $THE_userid, $patron ) = C4::Auth::checkpw( $identifier, $password ); unless ($status) { return $c->render( status => 400, @@ -79,8 +79,6 @@ sub validate { ); } - my $patron = Koha::Patrons->find( { cardnumber => $THE_cardnumber } ); - return $c->render( status => 201, openapi => { -- 2.43.0