From 2ad6647500502156dc0da611dc0a605f76a6558e Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 6 Dec 2021 08:31:48 +0000 Subject: [PATCH] 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 Signed-off-by: Jonathan Druart Signed-off-by: Fridolin Somers Signed-off-by: Kyle M Hall (cherry picked from commit 0c3cede046dd8cf68e238eb79aca3eea0925033a) Signed-off-by: Andrew Fuerste-Henry --- opac/opac-password-recovery.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opac/opac-password-recovery.pl b/opac/opac-password-recovery.pl index c0be4598d5..09a155847d 100755 --- a/opac/opac-password-recovery.pl +++ b/opac/opac-password-recovery.pl @@ -208,8 +208,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) -- 2.39.5