Make WordPress Core


Ignore:
Timestamp:
04/29/2020 04:48:42 PM (4 years ago)
Author:
whyisjake
Message:

User: Invalidate user_activation_key on password update.
Query: Ensure that only a single post can be returned on date/time based queries.
Cache API: Ensure proper escaping around the stats method in the cache API.
Formatting: Expand sanitize_file_name to have better support for utf8 characters.

Brings the changes in [47634], [47635], [47637], and [47638] to the 4.3 branch.

Props: batmoo, ehti, nickdaugherty, peterwilsoncc, sergeybiryukov, sstoqnov, westi, whyisjake, whyisjake, xknown.

Location:
branches/4.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.3

  • branches/4.3/tests/phpunit/tests/user.php

    r34118 r47656  
    565565    }
    566566
    567     function test_changing_email_invalidates_password_reset_key() {
     567    public function test_changing_email_invalidates_password_reset_key() {
    568568        global $wpdb;
    569569
     
    590590            'user_nicename' => 'cat',
    591591            'user_email'    => 'foo@bar.dev',
     592        );
     593        wp_update_user( $userdata );
     594
     595        $user = get_userdata( $user->ID );
     596        $this->assertEmpty( $user->user_activation_key );
     597    }
     598
     599    public function test_changing_password_invalidates_password_reset_key() {
     600        global $wpdb;
     601
     602        $user = $this->factory->user->create_and_get();
     603        $wpdb->update( $wpdb->users, array( 'user_activation_key' => 'key' ), array( 'ID' => $user->ID ) );
     604        clean_user_cache( $user );
     605
     606        $user = get_userdata( $user->ID );
     607        $this->assertEquals( 'key', $user->user_activation_key );
     608
     609        $userdata = array(
     610            'ID'        => $user->ID,
     611            'user_pass' => 'password',
    592612        );
    593613        wp_update_user( $userdata );
Note: See TracChangeset for help on using the changeset viewer.