Changeset 30433
- Timestamp:
- 11/20/2014 01:41:48 PM (11 years ago)
- Location:
- branches/3.8
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
src/wp-includes/user.php (modified) (1 diff)
-
tests/phpunit/tests/user.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/3.8
-
branches/3.8/src/wp-includes/user.php
r26493 r30433 1410 1410 1411 1411 if ( $update ) { 1412 if ( $user_email !== $old_user_data->user_email ) { 1413 $data['user_activation_key'] = ''; 1414 } 1412 1415 $wpdb->update( $wpdb->users, $data, compact( 'ID' ) ); 1413 1416 $user_id = (int) $ID; -
branches/3.8/tests/phpunit/tests/user.php
r25440 r30433 628 628 $this->assertInstanceOf( 'WP_Error', wp_update_user( array( 'ID' => $user_id ) ) ); 629 629 } 630 631 function test_changing_email_invalidates_password_reset_key() { 632 global $wpdb; 633 634 $user = $this->factory->user->create_and_get(); 635 $wpdb->update( $wpdb->users, array( 'user_activation_key' => 'key' ), array( 'ID' => $user->ID ) ); 636 clean_user_cache( $user ); 637 638 $user = get_userdata( $user->ID ); 639 $this->assertEquals( 'key', $user->user_activation_key ); 640 641 // Check that changing something other than the email doesn't remove the key. 642 $userdata = array( 643 'ID' => $user->ID, 644 'user_nicename' => 'wat', 645 ); 646 wp_update_user( $userdata ); 647 648 $user = get_userdata( $user->ID ); 649 $this->assertEquals( 'key', $user->user_activation_key ); 650 651 // Now check that changing the email does remove it. 652 $userdata = array( 653 'ID' => $user->ID, 654 'user_nicename' => 'cat', 655 'user_email' => 'foo@bar.dev', 656 ); 657 wp_update_user( $userdata ); 658 659 $user = get_userdata( $user->ID ); 660 $this->assertEmpty( $user->user_activation_key ); 661 } 630 662 }
Note: See TracChangeset
for help on using the changeset viewer.