View | Details | Raw Unified | Return to bug 34313
Collapse All | Expand All

(-)a/Koha/REST/V1/Auth/Password.pm (-4 / +12 lines)
Lines 65-71 sub validate { Link Here
65
    my $password = $body->{password} // "";
65
    my $password = $body->{password} // "";
66
66
67
    return try {
67
    return try {
68
        my ( $status, $cardnumber, $userid ) = C4::Auth::checkpw( $identifier, $password );
68
        my ( $status, $THE_cardnumber, $THE_userid ) = C4::Auth::checkpw( $identifier, $password );
69
        unless ($status) {
69
        unless ($status) {
70
            return $c->render(
70
            return $c->render(
71
                status  => 400,
71
                status  => 400,
Lines 73-81 sub validate { Link Here
73
            );
73
            );
74
        }
74
        }
75
75
76
        return $c->render( status => 204, openapi => '' );
76
        my $patron = Koha::Patrons->find( { cardnumber => $THE_cardnumber } );
77
    }
77
78
    catch {
78
        return $c->render(
79
            status  => 201,
80
            openapi => {
81
                cardnumber => $patron->cardnumber,
82
                patron_id  => $patron->id,
83
                userid     => $patron->userid,
84
            }
85
        );
86
    } catch {
79
        if ( blessed $_ and $_->isa('Koha::Exceptions::Password') ) {
87
        if ( blessed $_ and $_->isa('Koha::Exceptions::Password') ) {
80
            return $c->render(
88
            return $c->render(
81
                status  => 400,
89
                status  => 400,
(-)a/api/v1/swagger/paths/auth.yaml (-2 / +14 lines)
Lines 1091-1098 Link Here
1091
    produces:
1091
    produces:
1092
      - application/json
1092
      - application/json
1093
    responses:
1093
    responses:
1094
      "204":
1094
      "201":
1095
        description: Validation successful
1095
        description: Validation successful
1096
        schema:
1097
          type: object
1098
          properties:
1099
            cardnumber:
1100
              type: string
1101
              description: cardnumber for the validated patron
1102
            patron_id:
1103
              type: integer
1104
              description: Internal patron identifier
1105
            userid:
1106
              type: string
1107
              description: userid for the validated patron
1108
          additionalProperties: false
1096
      "400":
1109
      "400":
1097
        description: Bad request
1110
        description: Bad request
1098
        schema:
1111
        schema:
1099
- 

Return to bug 34313