Bug 35204: Prevent an expired password from throwing a 500 error
authorMatt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Wed, 6 Dec 2023 10:03:45 +0000 (10:03 +0000)
committerLucas Gass <lucas@bywatersolutions.com>
Thu, 4 Jan 2024 20:24:31 +0000 (20:24 +0000)
commit24f067b0cf220c035ba5773956d19e0a80a75044
treed32b0421045a35aba7fb66f750b7b7170660af21
parent1fc5a820bbe99a1be084349ba4c166cca2ccf204
Bug 35204: Prevent an expired password from throwing a 500 error

Currently when a patron with an expired password is authenticated via the API a 500 error is returned rather than a 400 "Validation failed" error. This patch catches the return value for an expired password and returns the validation failure before the patron search is attempted.

Test plan:
1) Choose a patron and set their password expiry date to a date in the past
2) Send a request to auth/password/validation as an authenticated user with that patron's details
3) The response should be a 500 error
4) Apply patch
5) Repeat steps 1-3 and this time the response should be a 400 code with an error message of  "Password expired"

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit f3bb88505245228d97a4e39612b17a688df64a79)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit df9d4b0f55fa6b4c430a77686d8e00804eed88de)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Koha/REST/V1/Auth/Password.pm