WordPress.org

Make WordPress Core

Changeset 44784


Ignore:
Timestamp:
02/28/2019 10:57:47 PM (6 months ago)
Author:
SergeyBiryukov
Message:

Users: Revert [44780] pending test failure investigation.

See #45845.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/user.php

    r44780 r44784  
    23212321    }
    23222322
    2323     $user = get_user_by( 'login', $login );
    2324 
    2325     if ( ! $user ) {
     2323    $row = $wpdb->get_row( $wpdb->prepare( "SELECT ID, user_activation_key FROM $wpdb->users WHERE user_login = %s", $login ) );
     2324    if ( ! $row ) {
    23262325        return new WP_Error( 'invalid_key', __( 'Invalid key' ) );
    23272326    }
     
    23412340    $expiration_duration = apply_filters( 'password_reset_expiration', DAY_IN_SECONDS );
    23422341
    2343     if ( false !== strpos( $user->user_activation_key, ':' ) ) {
    2344         list( $pass_request_time, $pass_key ) = explode( ':', $user->user_activation_key, 2 );
     2342    if ( false !== strpos( $row->user_activation_key, ':' ) ) {
     2343        list( $pass_request_time, $pass_key ) = explode( ':', $row->user_activation_key, 2 );
    23452344        $expiration_time                      = $pass_request_time + $expiration_duration;
    23462345    } else {
    2347         $pass_key        = $user->user_activation_key;
     2346        $pass_key        = $row->user_activation_key;
    23482347        $expiration_time = false;
    23492348    }
     
    23562355
    23572356    if ( $hash_is_correct && $expiration_time && time() < $expiration_time ) {
    2358         return $user;
     2357        return get_userdata( $row->ID );
    23592358    } elseif ( $hash_is_correct && $expiration_time ) {
    23602359        // Key has an expiration time that's passed
     
    23622361    }
    23632362
    2364     if ( hash_equals( $user->user_activation_key, $key ) || ( $hash_is_correct && ! $expiration_time ) ) {
     2363    if ( hash_equals( $row->user_activation_key, $key ) || ( $hash_is_correct && ! $expiration_time ) ) {
    23652364        $return  = new WP_Error( 'expired_key', __( 'Invalid key' ) );
    2366         $user_id = $user->ID;
     2365        $user_id = $row->ID;
    23672366
    23682367        /**
Note: See TracChangeset for help on using the changeset viewer.