Make WordPress Core


Ignore:
Timestamp:
04/29/2020 04:24: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.6 branch.

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

Location:
branches/4.6
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.6

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

    r38005 r47651  
    925925    }
    926926
    927     function test_changing_email_invalidates_password_reset_key() {
     927    public function test_changing_email_invalidates_password_reset_key() {
    928928        global $wpdb;
    929929
     
    950950            'user_nicename' => 'cat',
    951951            'user_email'    => 'foo@bar.dev',
     952        );
     953        wp_update_user( $userdata );
     954
     955        $user = get_userdata( $user->ID );
     956        $this->assertEmpty( $user->user_activation_key );
     957    }
     958
     959    public function test_changing_password_invalidates_password_reset_key() {
     960        global $wpdb;
     961
     962        $user = $this->author;
     963        $wpdb->update( $wpdb->users, array( 'user_activation_key' => 'key' ), array( 'ID' => $user->ID ) );
     964        clean_user_cache( $user );
     965
     966        $user = get_userdata( $user->ID );
     967        $this->assertEquals( 'key', $user->user_activation_key );
     968
     969        $userdata = array(
     970            'ID'        => $user->ID,
     971            'user_pass' => 'password',
    952972        );
    953973        wp_update_user( $userdata );
Note: See TracChangeset for help on using the changeset viewer.