diff --git a/Koha/REST/V1/Auth/Password.pm b/Koha/REST/V1/Auth/Password.pm index d5ea5c726f..4369ffd187 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, $cardnumber, $userid ) = C4::Auth::checkpw( $identifier, $password ); + my ( $status, $THE_cardnumber, $THE_userid ) = C4::Auth::checkpw( $identifier, $password ); unless ($status) { return $c->render( status => 400, @@ -79,9 +79,17 @@ sub validate { ); } - return $c->render( status => 204, openapi => '' ); - } - catch { + my $patron = Koha::Patrons->find( { cardnumber => $THE_cardnumber } ); + + return $c->render( + status => 201, + openapi => { + cardnumber => $patron->cardnumber, + patron_id => $patron->id, + userid => $patron->userid, + } + ); + } catch { if ( blessed $_ and $_->isa('Koha::Exceptions::Password') ) { return $c->render( status => 400, diff --git a/api/v1/swagger/paths/auth.yaml b/api/v1/swagger/paths/auth.yaml index 44d6035f05..b893db9d91 100644 --- a/api/v1/swagger/paths/auth.yaml +++ b/api/v1/swagger/paths/auth.yaml @@ -1095,8 +1095,21 @@ produces: - application/json responses: - "204": + "201": description: Validation successful + schema: + type: object + properties: + cardnumber: + type: string + description: cardnumber for the validated patron + patron_id: + type: integer + description: Internal patron identifier + userid: + type: string + description: userid for the validated patron + additionalProperties: false "400": description: Bad request schema: