[Koha-bugs] [Bug 31739] Password reset from staff fails if previous expired reset-entry exists

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Oct 19 00:24:51 CEST 2022


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31739

--- Comment #6 from David Nind <david at davidnind.com> ---
Testing notes (using koha-testing-docker):

1. For a patron category (for example, Patron (PT)), set 'Password reset in
OPAC' to 'Allowed' (Administration > Patrons and circulation > Patron
categories).

2. Enable system to send emails (for testing, using Gmail) and restart
everything (flush_memcached, restart_all):
   - You need a valid SMTP configuration in koha-conf.xml.
   - Generate an 'app password' for your Gmail account.
   - Edit koha-conf.xml and add this configuration (YOUR APP PASSWORD = the app
password):
     <smtp_server>
       <host>smtp.gmail.com</host>
       <port>587</port>
       <timeout>5</timeout>
       <ssl_mode>STARTTLS</ssl_mode>
       <user_name>YOUR GMAIL ADDRESS</user_name>
       <password>YOUR APP PASSWORD</password>
       <debug>1</debug>
     </smtp_server>

3. Update the details for a patron:
   - add your Gmail address to a patron (for example: YOUR GMAIL ADDRESS for
Mary Burton, borrower number 49)
   - update the OPAC/Staff interface login username (for example: mary)

4. Initiate a password reset from the OPAC:
   . From the OPAC home page, click on 'Forgot your password' below the log in
box
   . Enter the username for the login and press 'Submit'

5. Update the expiry date for the password reset in the database so that it is
expired:
   - List password recovery requests:
     . koha-mysql kohadev
     . select * from borrower_password_recovery;
   - Update the expiry date:
     . update borrower_password_recovery set valid_until = "2022-10-18
00:00:00" where borrowernumber=49;

6. Go to the patron's details page in the staff interface and select More >
Send password reset:
   ==> You get an error trace: 
       DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st
execute failed: Duplicate entry '49' for key 'PRIMARY' at
/kohadevbox/koha/Koha/Patron/Password/Recovery.pm line 132  at
/usr/share/perl5/DBIx/Class/Exception.pm line 77

7. Apply the patch and restart everything (flush_memcached, restart_all).

8. Send password reset from the staff interface again - it should now work
(email received and 'Koha password reset' notice under notices).

9. Re-test the forgotten password recovery process - steps 4, 5 and 8.
Everything should work as expected:
   . Note that for step 4 you may get an error message "The process of password
recovery has already been started for this account ("mary")...". Click on the
link 'Get new password recovery link'.

10. Tests should pass: prove t/db_dependent/Passwordrecovery.t

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list