From d81c481f552c0c193fe1b385cbaa1e7aceff8588 Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Thu, 5 Nov 2020 15:52:47 +0100 Subject: [PATCH] Bug 26941: Fix OPAC password recovery error messages In OPAC password recovery perl opac/opac-password-recovery.pl there are some error codes not in Template koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-password-recovery.tt This patch fixes several bugs: - remove 'use Koha::Patrons' defined twice - remove vars $errTooManyEmailFound $errBadEmail, not used in any template - add in template text for error 'errNoBorrowerEmail' 1) Create a patron A with login but no email 2) Create a patron B with login and valid email 3) Go to system preferences set 'OpacResetPassword' to ON 4) Make sure that OpacPasswordChange is also ON 5) Go to 'Forgot your password' in OPAC 6) Enter login if patron A and save => You get message 'This account has no email address we can send the email to.' 7) Enter login if patron B and save => Password recovery is send, no error message Signed-off-by: Lucas Gass Signed-off-by: Victor Grousset/tuxayo Signed-off-by: Jonathan Druart Signed-off-by: Fridolin Somers --- .../bootstrap/en/modules/opac-password-recovery.tt | 2 ++ opac/opac-password-recovery.pl | 6 ------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-password-recovery.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-password-recovery.tt index fe5de79ea2..045d15ab2d 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-password-recovery.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-password-recovery.tt @@ -84,6 +84,8 @@ [% ELSIF (errMultipleAccountsForEmail) %] Account identification with this email address only is ambiguous.
Please use the field 'Login' as well. + [% ELSIF (errNoBorrowerEmail) %] + This account has no email address we can send the email to. [% ELSIF (errAlreadyStartRecovery) %] The process of password recovery has already been started for this account [% IF username %] diff --git a/opac/opac-password-recovery.pl b/opac/opac-password-recovery.pl index f4686bbb37..c0be4598d5 100755 --- a/opac/opac-password-recovery.pl +++ b/opac/opac-password-recovery.pl @@ -10,7 +10,6 @@ use C4::Context; use Koha::Patron::Password::Recovery qw(SendPasswordRecoveryEmail ValidateBorrowernumber GetValidLinkInfo CompletePasswordRecovery DeleteExpiredPasswordRecovery); use Koha::Patrons; -use Koha::Patrons; my $query = CGI->new; use HTML::Entities; use Try::Tiny; @@ -42,8 +41,6 @@ my $errNoBorrowerFound; my $errNoBorrowerEmail; my $errMultipleAccountsForEmail; my $errAlreadyStartRecovery; -my $errTooManyEmailFound; -my $errBadEmail; my $errResetForbidden; #new password form error @@ -123,11 +120,8 @@ if ( $query->param('sendEmail') || $query->param('resendEmail') ) { if ($hasError) { $template->param( hasError => 1, - errNoBorrowerFound => $errNoBorrowerFound, - errTooManyEmailFound => $errTooManyEmailFound, errAlreadyStartRecovery => $errAlreadyStartRecovery, - errBadEmail => $errBadEmail, errNoBorrowerEmail => $errNoBorrowerEmail, errMultipleAccountsForEmail => $errMultipleAccountsForEmail, errResetForbidden => $errResetForbidden, -- 2.39.5