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

(-)a/Koha/REST/V1/Auth/Password.pm (-4 / +12 lines)
Lines 71-77 sub validate { Link Here
71
    my $password = $body->{password} // "";
71
    my $password = $body->{password} // "";
72
72
73
    return try {
73
    return try {
74
        my ( $status, $cardnumber, $userid ) = C4::Auth::checkpw( $identifier, $password );
74
        my ( $status, $THE_cardnumber, $THE_userid ) = C4::Auth::checkpw( $identifier, $password );
75
        unless ($status) {
75
        unless ($status) {
76
            return $c->render(
76
            return $c->render(
77
                status  => 400,
77
                status  => 400,
Lines 79-87 sub validate { Link Here
79
            );
79
            );
80
        }
80
        }
81
81
82
        return $c->render( status => 204, openapi => '' );
82
        my $patron = Koha::Patrons->find( { cardnumber => $THE_cardnumber } );
83
    }
83
84
    catch {
84
        return $c->render(
85
            status  => 201,
86
            openapi => {
87
                cardnumber => $patron->cardnumber,
88
                patron_id  => $patron->id,
89
                userid     => $patron->userid,
90
            }
91
        );
92
    } catch {
85
        if ( blessed $_ and $_->isa('Koha::Exceptions::Password') ) {
93
        if ( blessed $_ and $_->isa('Koha::Exceptions::Password') ) {
86
            return $c->render(
94
            return $c->render(
87
                status  => 400,
95
                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