From 0c3cede046dd8cf68e238eb79aca3eea0925033a 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 --- 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 9ee1278c0a..d1cdde3897 100755 --- a/opac/opac-password-recovery.pl +++ b/opac/opac-password-recovery.pl @@ -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) -- 2.39.5