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

WordPress Trac noreply at wordpress.org
Thu May 25 13:49:19 UTC 2023


#58407: resetpassword action on users.php (users list page) handles
retrieve_password() return incorrectly
----------------------------------------+---------------------------------
 Reporter:  letraceursnork              |       Owner:  (none)
     Type:  defect (bug)                |      Status:  new
 Priority:  normal                      |   Milestone:  6.3
Component:  Users                       |     Version:  6.2.2
 Severity:  trivial                     |  Resolution:
 Keywords:  needs-patch good-first-bug  |     Focuses:  ui, administration
----------------------------------------+---------------------------------
Changes (by SergeyBiryukov):

 * keywords:   => needs-patch good-first-bug
 * milestone:  Awaiting Review => 6.3


Comment:

 Hi there, welcome back to WordPress Trac! Thanks for the ticket.

 Good catch, we should update that condition to either explicitly check for
 `true`:
 {{{
 if ( true === retrieve_password( $user->user_login ) ) {
         ++$reset_count;
 }
 }}}
 or check for `is_wp_error()`:
 {{{
 if ( ! is_wp_error( retrieve_password( $user->user_login ) ) ) {
         ++$reset_count;
 }
 }}}

 We use the former in [source:tags/6.2.2/src/wp-admin/includes/ajax-
 actions.php?marks=5554#L5550 wp-admin/includes/ajax-actions.php] and the
 latter in [source:tags/6.2.2/src/wp-login.php?marks=796#L791 wp-
 login.php]. I don't have a strong preference at the moment, but it would
 be great to have some consistency with these checks :)

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


More information about the wp-trac mailing list