[wp-trac] [WordPress Trac] #58407: resetpassword action on users.php (users list page) handles retrieve_password() return incorrectly

WordPress Trac noreply at wordpress.org
Sun Oct 15 14:02:49 UTC 2023


#58407: resetpassword action on users.php (users list page) handles
retrieve_password() return incorrectly
-------------------------------------------------+-------------------------
 Reporter:  letraceursnork                       |       Owner:
                                                 |  hellofromTonya
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  6.4
Component:  Users                                |     Version:  6.2.2
 Severity:  trivial                              |  Resolution:  fixed
 Keywords:  good-first-bug has-patch has-        |     Focuses:  ui,
  testing-info has-screenshots commit            |  administration
-------------------------------------------------+-------------------------
Changes (by hellofromTonya):

 * status:  reviewing => closed
 * resolution:   => fixed


Comment:

 In [changeset:"56937" 56937]:
 {{{
 #!CommitTicketReference repository="" revision="56937"
 Users: Show "Password reset link sent" message only when finished.

 When an admin sends a password reset link to a user (from the Users UI
 screen), the "finished" UI message:

 >Password reset link sent.

 is displayed on "finished" and no longer displayed on error.

 **What is the change?**

 Previously, the conditional (for incrementing the reset counter) checked
 for a truthy return from `retrieve_password()`. But `retrieve_password()`
 always returns a truthy state: `true` (meaning "finished") or an instance
 of `WP_Error`. Thus, checking for a truthy meant the "finished" message
 was sent on both "finished" and error/failed.

 This fix checks for `retrieve_password()` returning `true` to indicate
 "finished".

 **What is displayed on error?**

 If `retrieve_password()` returns an instance of `WP_Error`, the following
 UI message is shown:

 >Password reset links sent to 0 users.

 The UI messages were not modified by this changeset.

 Follow-up to [50129].

 Props letraceursnork, prashantbhivsane, audrasjb, costdev, dilipbheda,
 hareesh-pillai, hellofromTonya, ironprogrammer, huzaifaalmesbah, marybaum,
 nicolefurlan, oglekler, petitphp, SergeyBiryukov.
 Fixes #58407.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58407#comment:40>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list