[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 12 16:37:38 CEST 2022


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

--- Comment #2 from Björn Nylén <bjorn.nylen at ub.lu.se> ---
Created attachment 141732
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=141732&action=edit
Bug 31739:  Remove need to pass update param to
Koha::Patron::Password::Recovery::SendPasswordRecoveryEmail

Bug 31739: Password recovery from staff fails if previous expired reset-entry
exists.

SendPasswordRecoveryEmail relies on the calling script to tell if there is an
existing valid recovery already. If there's an expired recovery-entry the
members/notices.pl script will try to create a new entry resulting in a
duplicate key error.

This patch fixes the bug by removing the need for the calling script to do the
check since SendPasswordRecoveryEmail does the same thing anyway.
SendPasswordRecoveryEmail will now use DBIx ->update_or_create instead of
looking at the $update param to determine if it should update an existing entry
or create a new.

The update param is removed from all calling scripts and test are updated.

To test:
1. Generate a password recovery mail for a patron
2. Let it expire.
3. Generate a new password recovery from staff to the same patron - Fail!
4: Apply patch
5. Generate a new password recovery from staff to the same patron - Success!
6. Opac password recovery flow should also work.
7. Tests pass.

Sponsored-by: Lund University Library

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


More information about the Koha-bugs mailing list