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

(-)a/Koha/REST/V1/Auth/Password.pm (-4 / +4 lines)
Lines 41-47 Controller method that checks a patron's password Link Here
41
sub validate {
41
sub validate {
42
    my $c = shift->openapi->valid_input or return;
42
    my $c = shift->openapi->valid_input or return;
43
43
44
    my $body   = $c->req->json;
44
    my $body       = $c->req->json;
45
    my $identifier = $body->{identifier};
45
    my $identifier = $body->{identifier};
46
    my $userid     = $body->{userid};
46
    my $userid     = $body->{userid};
47
47
Lines 72-81 sub validate { Link Here
72
72
73
    return try {
73
    return try {
74
        my ( $status, $THE_cardnumber, $THE_userid ) = C4::Auth::checkpw( $identifier, $password );
74
        my ( $status, $THE_cardnumber, $THE_userid ) = C4::Auth::checkpw( $identifier, $password );
75
        unless ($status) {
75
        unless ( $status && $status > 0 ) {
76
            my $error_response = $status == -2 ? 'Password expired' : 'Validation failed';
76
            return $c->render(
77
            return $c->render(
77
                status  => 400,
78
                status  => 400,
78
                openapi => { error => "Validation failed" }
79
                openapi => { error => $error_response }
79
            );
80
            );
80
        }
81
        }
81
82
82
- 

Return to bug 35204