Making WordPress.org

Changeset 6395


Ignore:
Timestamp:
01/18/2018 06:10:58 AM (7 years ago)
Author:
dd32
Message:

Login: Clear the user cache after updating the activation key, fetch the key directly from the database in the event the cached object doesn't have it temporarily.

Fixes #3390.

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/functions-registration.php

    r5385 r6395  
    4949    }
    5050    $hashed_activation_key = time() . ':' . $wp_hasher->HashPassword( $activation_key );
    51     $bool = $wpdb->update( $wpdb->users, array( 'user_activation_key' => $hashed_activation_key ), array( 'ID' => $user_id ) );
     51
     52    $wpdb->update( $wpdb->users, array( 'user_activation_key' => $hashed_activation_key ), array( 'ID' => $user_id ) );
     53    clean_user_cache( $user_id );
    5254
    5355    if ( $user_mailinglist ) {
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-login/register-confirm.php

    r5385 r6395  
    1818) {
    1919    wp_set_current_user( $user->ID );
    20     list( $reset_time, $hashed_activation_key ) = explode( ':', $user->user_activation_key, 2 );
     20
     21    $user_activation_key = $user->user_activation_key;
     22    if ( ! $user_activation_key ) {
     23        // The activation key may not be in the cached user object, so we'll fetch it manually.
     24        $user_activation_key = $wpdb->get_var( $wpdb->prepare( "SELECT user_activation_key FROM {$wpdb->users} WHERE ID = %d", $user->ID ) );
     25    }
     26
     27    list( $reset_time, $hashed_activation_key ) = explode( ':', $user_activation_key, 2 );
    2128
    2229    if ( empty( $wp_hasher ) ) {
Note: See TracChangeset for help on using the changeset viewer.