From a471ad80bb70ed790cf7f544a45cdd3e61672ff4 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 15 Feb 2017 17:14:11 +0000 Subject: [PATCH] Bug 18025: Simplify logic and avoid 1 call to ValidateBorrowernumber Signed-off-by: Liz Rea This is fine with me. Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- opac/opac-password-recovery.pl | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/opac/opac-password-recovery.pl b/opac/opac-password-recovery.pl index 2099caf39b..8c76015700 100755 --- a/opac/opac-password-recovery.pl +++ b/opac/opac-password-recovery.pl @@ -90,16 +90,14 @@ if ( $query->param('sendEmail') || $query->param('resendEmail') ) { } # Check if a password reset already issued for this borrower AND we are not asking for a new email - elsif ( ValidateBorrowernumber( $borrower->borrowernumber ) - && !$query->param('resendEmail') ) - { - $hasError = 1; - $errAlreadyStartRecovery = 1; - } - elsif ( !ValidateBorrowernumber($borrower->borrowernumber) - && !$query->param('resendEmail') ) - { - DeleteExpiredPasswordRecovery($borrower->borrowernumber); + elsif ( not $query->param('resendEmail') ) { + if ( ValidateBorrowernumber( $borrower->borrowernumber ) ) { + $hasError = 1; + $errAlreadyStartRecovery = 1; + } + else { + DeleteExpiredPasswordRecovery( $borrower->borrowernumber ); + } } } else { # 0 matching borrower -- 2.39.5