Bugzilla – Attachment 63591 Details for
Bug 16711
OPAC Password recovery: Handling if multiple accounts have the same mail address
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16711: OPAC Password recovery: Handling if multiple accounts have the same mail address
Bug-16711-OPAC-Password-recovery-Handling-if-multi.patch (text/plain), 5.09 KB, created by
Marc Véron
on 2017-05-21 16:40:05 UTC
(
hide
)
Description:
Bug 16711: OPAC Password recovery: Handling if multiple accounts have the same mail address
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2017-05-21 16:40:05 UTC
Size:
5.09 KB
patch
obsolete
>From 2a2625f52dbcb1e998402f1f857ef7b9a9c47d33 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Marc=20V=C3=A9ron?= <veron@veron.ch> >Date: Sun, 21 May 2017 18:28:48 +0200 >Subject: [PATCH] Bug 16711: OPAC Password recovery: Handling if multiple > accounts have the same mail address > >To reproduce: >- Create 3 Accounts, login names are test01, test02, test03, Email is the same >for all. >- Go to OPAC -> Password recovery and indicate E-Mail only >- You will get an email for only one of the accounts above. > >To test: >- Apply patch, restart memcached and plack >- Go to db, delete from borrower_password_recovery; >- Try steps above to reproduce. You will get an error message: > Account identification with this email address only is ambiguous. > Please use the field 'Login' as well. >- Verify that other cases work as before (provide valid / invalid login only, > provide valid email for an existing account, provide unknown email, provide > both login and email with all combinations of valid / invalid) >--- > .../bootstrap/en/modules/opac-password-recovery.tt | 5 ++++- > opac/opac-password-recovery.pl | 16 +++++++++++++++- > 2 files changed, 19 insertions(+), 2 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 9d27b4b..b625a2a 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 >@@ -54,6 +54,9 @@ > <br/>Please try again later. > [% ELSIF (errNoBorrowerFound) %] > No account was found with the provided information. >+ [% ELSIF (errMultipleAccountsForEmail) %] >+ Account identification with this email address only is ambiguous. >+ <br />Please use the field 'Login' as well. > [% ELSIF (errAlreadyStartRecovery) %] > The process of password recovery has already been started for this account ("<strong>[% username %]</strong>") > <br/>You should have received an email with a link to reset your password. >@@ -78,7 +81,7 @@ > <form action="/cgi-bin/koha/opac-password-recovery.pl" method="post"> > <input type="hidden" name="koha_login_context" value="opac" /> > <fieldset> >- <p>To reset your password, enter your login and email address. >+ <p>To reset your password, enter your login and your email address. > <label for="username">Login:</label> > <input type="text" id="username" size="40" name="username" value="[% username %]" /> > <label for="email">Email:</label> >diff --git a/opac/opac-password-recovery.pl b/opac/opac-password-recovery.pl >index 8c76015..0a35e78 100755 >--- a/opac/opac-password-recovery.pl >+++ b/opac/opac-password-recovery.pl >@@ -36,10 +36,12 @@ my $borrower_number; > > #errors > my $hasError; >+my $resultCount; > > #email form error > my $errNoBorrowerFound; > my $errNoBorrowerEmail; >+my $errMultipleAccountsForEmail; > my $errAlreadyStartRecovery; > my $errTooManyEmailFound; > my $errBadEmail; >@@ -59,14 +61,25 @@ if ( $query->param('sendEmail') || $query->param('resendEmail') ) { > # Find the borrower by his userid or email > if ($username) { > $search_results = [ Koha::Patrons->search( { userid => $username } ) ]; >+ $resultCount = Koha::Patrons->search( { userid => $username } ) -> count > } > elsif ($email) { > $search_results = [ Koha::Patrons->search( { -or => { email => $email, emailpro => $email, B_email => $email } } ) ]; >+ $resultCount = Koha::Patrons->search( { -or => { email => $email, emailpro => $email, B_email => $email } } ) -> count; > } >- if ( not $search_results || scalar @$search_results > 1 ) { >+ >+ if ( not $search_results || $resultCount < 1) { >+ $hasError = 1; >+ $errNoBorrowerFound = 1; >+ } >+ elsif ( $username && scalar $resultCount > 1) { # Multiple accounts for username > $hasError = 1; > $errNoBorrowerFound = 1; > } >+ elsif ( $email && scalar $resultCount > 1) { # Muliple accounts for E-Mail >+ $hasError = 1; >+ $errMultipleAccountsForEmail = 1; >+ } > elsif ( $borrower = shift @$search_results ) { # One matching borrower > $username ||= $borrower->userid; > my @emails = ( $borrower->email, $borrower->emailpro, $borrower->B_email ); >@@ -112,6 +125,7 @@ if ( $query->param('sendEmail') || $query->param('resendEmail') ) { > errAlreadyStartRecovery => $errAlreadyStartRecovery, > errBadEmail => $errBadEmail, > errNoBorrowerEmail => $errNoBorrowerEmail, >+ errMultipleAccountsForEmail => $errMultipleAccountsForEmail, > password_recovery => 1, > email => HTML::Entities::encode($email), > username => $username >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 16711
:
63591
|
63600
|
64064
|
64598
|
64604
|
64605