From 11dfdd82ac0a4f347ca06a13944a0b0ca4758afd 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: - typo in 'use Koha::Patrons' defined twice => 'use Koha::Patron' - 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 --- .../bootstrap/en/modules/opac-password-recovery.tt | 2 ++ opac/opac-password-recovery.pl | 7 +------ 2 files changed, 3 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 57e13087c9..964e51f1f2 100755 --- a/opac/opac-password-recovery.pl +++ b/opac/opac-password-recovery.pl @@ -9,7 +9,7 @@ use C4::Output; use C4::Context; use Koha::Patron::Password::Recovery qw(SendPasswordRecoveryEmail ValidateBorrowernumber GetValidLinkInfo CompletePasswordRecovery DeleteExpiredPasswordRecovery); -use Koha::Patrons; +use Koha::Patron; use Koha::Patrons; my $query = CGI->new; use HTML::Entities; @@ -42,8 +42,6 @@ my $errNoBorrowerFound; my $errNoBorrowerEmail; my $errMultipleAccountsForEmail; my $errAlreadyStartRecovery; -my $errTooManyEmailFound; -my $errBadEmail; my $errResetForbidden; #new password form error @@ -123,11 +121,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.29.1