Bug 29646: Fix undefined category crash in opac-password-recovery

The crash is a result of a not found borrower. This is typically
a bad or repeated recovery attempt.

Test plan:
Do a password recovery.
Use the mailed URL twice.
Without this patch, the second attempt crashes.
With this patch, the second attempt shows an error dialog.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Marcel de Rooy 2021-12-06 08:31:48 +00:00 committed by Fridolin Somers
parent e653effe57
commit a1ac05193d

View file

@ -211,8 +211,8 @@ elsif ($uniqueKey) { #reset password form
username => $username,
errLinkNotValid => $errLinkNotValid,
hasError => ( $errLinkNotValid ? 1 : 0 ),
minPasswordLength => $borrower->category->effective_min_password_length,
RequireStrongPassword => $borrower->category->effective_require_strong_password
minPasswordLength => $borrower ? $borrower->category->effective_min_password_length: undef,
RequireStrongPassword => $borrower ? $borrower->category->effective_require_strong_password: undef,
);
}
else { #password recovery form (to send email)