Ticket #45746: 45746-2.diff
File 45746-2.diff, 1.3 KB (added by , 6 years ago) |
---|
-
src/wp-includes/user.php
2187 2187 * 2188 2188 * @since 4.4.0 2189 2189 * 2190 * @global wpdb $wpdb WordPress database abstraction object.2191 2190 * @global PasswordHash $wp_hasher Portable PHP password hashing framework. 2192 2191 * 2193 2192 * @param WP_User $user User to retrieve password reset key for. … … 2195 2194 * @return string|WP_Error Password reset key on success. WP_Error on error. 2196 2195 */ 2197 2196 function get_password_reset_key( $user ) { 2198 global $wp db, $wp_hasher;2197 global $wp_hasher; 2199 2198 2200 2199 /** 2201 2200 * Fires before a new password is retrieved. … … 2258 2257 $wp_hasher = new PasswordHash( 8, true ); 2259 2258 } 2260 2259 $hashed = time() . ':' . $wp_hasher->HashPassword( $key ); 2261 $key_saved = $wpdb->update( $wpdb->users, array( 'user_activation_key' => $hashed ), array('user_login' => $user->user_login ) );2262 if ( false === $key_saved) {2263 return new WP_Error( 'no_password_key_update', __( 'Could not save password reset key to database.' ) );2260 $key_saved = wp_update_user( array( 'ID' => $user->ID, 'user_activation_key' => $hashed, 'user_login' => $user->user_login ) ); 2261 if ( is_wp_error( $key_saved ) ) { 2262 return $key_saved; 2264 2263 } 2265 2264 2266 2265 return $key;