Make WordPress Core


Ignore:
Timestamp:
04/29/2020 04:53:40 PM (6 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.0 branch.

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

File:
1 edited

Legend:

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

    r40455 r47659  
    616616        }
    617617
    618         function test_changing_email_invalidates_password_reset_key() {
     618        public function test_changing_email_invalidates_password_reset_key() {
    619619                global $wpdb;
    620620
     
    647647                $this->assertEmpty( $user->user_activation_key );
    648648        }
     649
     650        public function test_changing_password_invalidates_password_reset_key() {
     651                global $wpdb;
     652
     653                $user = $this->factory->user->create_and_get();
     654                $wpdb->update( $wpdb->users, array( 'user_activation_key' => 'key' ), array( 'ID' => $user->ID ) );
     655                clean_user_cache( $user );
     656
     657                $user = get_userdata( $user->ID );
     658                $this->assertEquals( 'key', $user->user_activation_key );
     659
     660                $userdata = array(
     661                        'ID'        => $user->ID,
     662                        'user_pass' => 'password',
     663                );
     664                wp_update_user( $userdata );
     665
     666                $user = get_userdata( $user->ID );
     667                $this->assertEmpty( $user->user_activation_key );
     668        }
     669
    649670}
Note: See TracChangeset for help on using the changeset viewer.