Bugzilla – Attachment 44330 Details for
Bug 8753
Add forgot password link to OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8753 - Various little things - removing new dependency, changes to errors, textual updates
Bug-8753---Various-little-things---removing-new-de.patch (text/plain), 9.81 KB, created by
Marc Véron
on 2015-11-03 11:22:41 UTC
(
hide
)
Description:
Bug 8753 - Various little things - removing new dependency, changes to errors, textual updates
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2015-11-03 11:22:41 UTC
Size:
9.81 KB
patch
obsolete
>From 242b0a62af3a2601fb98a4382e684d7a4ac847a1 Mon Sep 17 00:00:00 2001 >From: Liz Rea <liz@catalyst.net.nz> >Date: Wed, 7 Oct 2015 15:08:10 +1300 >Subject: [PATCH] Bug 8753 - Various little things - removing new dependency, > changes to errors, textual updates >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Koha already has a sub that creates salts, so lets use that instead of math::Random::secure, so as not to add a new dependency. > >Made the references to "Forgotten password" consistent, including adding it to the title of the page. > >Also removed the individual error for "this email doesn't belong to this account" as that could expose the existence of a login, which I think we'd rather not do. > >Made some of the text more grammatically correct, and more library specific. > >To test: > >Apply on top of all of the other patches. > >All the usual checks, plus make sure there are no typos in any text references. > >Signed-off-by: Marc Véron <veron@veron.ch> >--- > C4/Passwordrecovery.pm | 5 +-- > .../bootstrap/en/modules/opac-password-recovery.tt | 42 ++++++++------------ > opac/opac-password-recovery.pl | 10 ++--- > 3 files changed, 21 insertions(+), 36 deletions(-) > >diff --git a/C4/Passwordrecovery.pm b/C4/Passwordrecovery.pm >index 8090eeb..d8420db 100644 >--- a/C4/Passwordrecovery.pm >+++ b/C4/Passwordrecovery.pm >@@ -19,7 +19,7 @@ package C4::Passwordrecovery; > > use Modern::Perl; > use C4::Context; >-use Math::Random::Secure; >+use Crypt::Eksblowfish::Bcrypt qw(en_base64); > > use vars qw($VERSION @ISA @EXPORT); > >@@ -111,8 +111,7 @@ sub SendPasswordRecoveryEmail { > > # generate UUID > my @chars = ( "A" .. "Z", "a" .. "z", "0" .. "9" ); >- my $uuid_str; >- $uuid_str .= $chars[ rand @chars ] for 1 .. 32; >+ my $uuid_str = '$2a$08$'.en_base64(Koha::AuthUtils::generate_salt('weak', 16)); > > # insert into database > my $expirydate = >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 8ffb3e3..91ac94d 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 >@@ -1,6 +1,6 @@ > [% USE Koha %] > [% INCLUDE 'doc-head-open.inc' %] >-<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog</title> >+<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %] - Forgotten password recovery[% ELSE %]Koha online[% END %] catalog - Forgotten password recovery</title> > [% INCLUDE 'doc-head-close.inc' %] > [% BLOCK cssinclude %][% END %] > [% BLOCK jsinclude %] >@@ -30,7 +30,7 @@ > <div class="main"> > <ul class="breadcrumb"> > <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">›</span></li> >- <li><a href="#">Change your password</a></li> >+ <li><a href="#">Forgotten password recovery</a></li> > </ul> > > <div class="container-fluid"> >@@ -44,40 +44,31 @@ > [% END %] > </div> > <div class="span10"> >- <h3>Password recovery</h3> >+ <h3>Forgotten password recovery</h3> > [% IF (hasError) %] > <div class="alert alert-warning"> >- <h3>An error occurred</h3> >+ <h3>Oops!</h3> > <p> > [% IF (sendmailError) %] > An error has occurred while sending you the password recovery link. > <br/>Please try again later. > [% ELSIF (errNoBorrowerFound) %] > No account was found with the provided information. >- <br/>Check if you typed it correctly. >- [% ELSIF (errBadEmail) %] >- The provided email address is not tied to this account. >- [% ELSIF (errTooManyEmailFound) %] >- More than one account has been found for the email address: "<strong>[% email %]</strong>" >- <br/>Try to use your username or an alternative email if you have one. >- [% ELSIF (errNoBorrowerEmail) %] >- This account has no email address we can send the email to. > [% ELSIF (errAlreadyStartRecovery) %] >- The process of password recovery has already started for this account ("<strong>[% username %]</strong>") >- <br/>Check your emails; you should receive the link to reset your password. >- <br/>If you did not receive it, click <a href="/cgi-bin/koha/opac-password-recovery.pl?resendEmail=true&email=[% email %]&username=[% username %]">here</a> to get a new password recovery link. >+ 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. >+ <br/>If you did not receive this email, you can <a href="/cgi-bin/koha/opac-password-recovery.pl?resendEmail=true&email=[% email %]&username=[% username %]">request a new password recovery link.</a> > [% ELSIF (errPassNotMatch) %] >- The passwords entered does not match. >- <br/>Please try again. >+ Oops! The passwords must match. > [% ELSIF (errPassTooShort) %] >- The password is too short. >+ Your chosen password is too short. > <br/>The password must contain at least [% minPassLength %] characters. > [% ELSIF (errLinkNotValid) %] >- We could not authenticate you as the account owner. >- <br/>Be sure to use the link you received in your email. >+ The link you clicked is either invalid, or expired. >+ <br/>Be sure you used the link from the email, or contact library staff for assistance. > [% END %] > </p> >- <p>Please contact the staff if you need further assistance.</p> >+ <p>Please contact the library if you need further assistance.</p> > </div> > [% END %] > <div id="password-recovery"> >@@ -87,8 +78,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 username or email address. >- <br/>A link to reset your password will be sent at this address.</p> >+ <p>To reset your password, enter your login and email address. > <label for="username">Login:</label> > <input type="text" id="username" size="40" name="username" value="[% username %]" /> > <label for="email">Email:</label> >@@ -118,10 +108,10 @@ > <div class="alert alert-info"> > <p> > An email has been sent to "[% email %]". >- <br/>It contains a link to create a new password. >- <br/>This link will be valid for 2 days starting now. >+ <br/>Please click the link in this email to finish the process of resetting your password. >+ <br/>This link is valid for 2 days starting now. > </p> >- Click <a href="/cgi-bin/koha/opac-main.pl"">here</a> to return to the main page. >+ <a href="/cgi-bin/koha/opac-main.pl"">Return to the main page</a> > </div> > [% ELSIF (password_reset_done) %] > <div class="alert alert-success"> >diff --git a/opac/opac-password-recovery.pl b/opac/opac-password-recovery.pl >index 1cef3ed..6cfc414 100755 >--- a/opac/opac-password-recovery.pl >+++ b/opac/opac-password-recovery.pl >@@ -64,14 +64,10 @@ if ( $query->param('sendEmail') || $query->param('resendEmail') ) { > elsif ($email) { > $search_results = [ Koha::Borrowers->search( { -or => { email => $email, emailpro => $email, B_email => $email } } ) ]; > } >- if ( not $search_results ) { >+ if ( not $search_results || scalar @$search_results > 1 ) { > $hasError = 1; > $errNoBorrowerFound = 1; > } >- elsif ( scalar @$search_results > 1 ) { # Many matching borrowers >- $hasError = 1; >- $errTooManyEmailFound = 1; >- } > elsif ( $borrower = shift @$search_results ) { # One matching borrower > $username ||= $borrower->userid; > my @emails = ( $borrower->email, $borrower->emailpro, $borrower->B_email ); >@@ -79,7 +75,7 @@ if ( $query->param('sendEmail') || $query->param('resendEmail') ) { > # Is the given email one of the borrower's ? > if ( $email && !( grep { $_ eq $email } @emails ) ) { > $hasError = 1; >- $errBadEmail = 1; >+ $errNoBorrowerFound = 1; > } > > # If we dont have an email yet. Get one of the borrower's email or raise an error. >@@ -88,7 +84,7 @@ if ( $query->param('sendEmail') || $query->param('resendEmail') ) { > # It's supposed to get a non-empty string from the @emails array. There's surely a simpler way > elsif ( !$email && !( $email = shift [ grep { length() } @emails ] ) ) { > $hasError = 1; >- $errNoBorrowerEmail = 1; >+ $errNoBorrowerFound = 1; > } > > # Check if a password reset already issued for this borrower AND we are not asking for a new email >-- >1.7.10.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 8753
:
21502
|
21512
|
21521
|
21849
|
22175
|
22430
|
24586
|
24780
|
24781
|
24846
|
24853
|
24854
|
24855
|
24862
|
24906
|
24907
|
24908
|
25038
|
25039
|
25051
|
29111
|
33175
|
33176
|
34472
|
36819
|
37492
|
39049
|
39144
|
39165
|
39166
|
39167
|
39168
|
39827
|
41181
|
41192
|
41193
|
41455
|
41686
|
41687
|
41688
|
41706
|
43017
|
43183
|
43576
|
44305
|
44306
|
44307
|
44308
|
44309
|
44310
|
44311
|
44323
|
44324
|
44325
|
44326
|
44327
|
44329
|
44330
|
45209
|
45210
|
45211
|
45212
|
45213
|
45214
|
45215
|
45223
|
45224
|
45225
|
45226
|
45227
|
45228
|
45229
|
45230
|
46379
|
47164
|
47165
|
47166
|
47167
|
47168
|
47169
|
47170
|
47171
|
47357
|
47366