From f97d9c82a7ff743b6892e18e18bc0ac27207a984 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 --- 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 9ee1278c0ab..d1cdde38974 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.25.1