Make WordPress Core


Ignore:
Timestamp:
04/29/2020 04:51:02 PM (5 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.2 branch.

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

Location:
branches/4.2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.2

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

    r31963 r47657  
    669669    }
    670670
    671     function test_changing_email_invalidates_password_reset_key() {
     671    public function test_changing_email_invalidates_password_reset_key() {
    672672        global $wpdb;
    673673
     
    700700        $this->assertEmpty( $user->user_activation_key );
    701701    }
     702
     703    public function test_changing_password_invalidates_password_reset_key() {
     704        global $wpdb;
     705
     706        $user = $this->factory->user->create_and_get();
     707        $wpdb->update( $wpdb->users, array( 'user_activation_key' => 'key' ), array( 'ID' => $user->ID ) );
     708        clean_user_cache( $user );
     709
     710        $user = get_userdata( $user->ID );
     711        $this->assertEquals( 'key', $user->user_activation_key );
     712
     713        $userdata = array(
     714            'ID'        => $user->ID,
     715            'user_pass' => 'password',
     716        );
     717        wp_update_user( $userdata );
     718
     719        $user = get_userdata( $user->ID );
     720        $this->assertEmpty( $user->user_activation_key );
     721    }
     722
    702723}
Note: See TracChangeset for help on using the changeset viewer.