Make WordPress Core


Ignore:
Timestamp:
04/29/2020 04:52:21 PM (7 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.1 branch.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/4.1/tests/phpunit/tests/user.php

    r30513 r47658  
    634634        }
    635635
    636         function test_changing_email_invalidates_password_reset_key() {
     636        public function test_changing_email_invalidates_password_reset_key() {
    637637                global $wpdb;
    638638
    … …  
    665665                $this->assertEmpty( $user->user_activation_key );
    666666        }
     667
     668        public function test_changing_password_invalidates_password_reset_key() {
     669                global $wpdb;
     670
     671                $user = $this->factory->user->create_and_get();
     672                $wpdb->update( $wpdb->users, array( 'user_activation_key' => 'key' ), array( 'ID' => $user->ID ) );
     673                clean_user_cache( $user );
     674
     675                $user = get_userdata( $user->ID );
     676                $this->assertEquals( 'key', $user->user_activation_key );
     677
     678                $userdata = array(
     679                        'ID'        => $user->ID,
     680                        'user_pass' => 'password',
     681                );
     682                wp_update_user( $userdata );
     683
     684                $user = get_userdata( $user->ID );
     685                $this->assertEmpty( $user->user_activation_key );
     686        }
     687
    667688}
Note: See TracChangeset for help on using the changeset viewer.