|
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, |