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