Changeset 46650
- Timestamp:
- 11/04/2019 03:04:41 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-login.php
r46640 r46650 374 374 } 375 375 } else { 376 $login = trim( $_POST['user_login']);376 $login = trim( wp_unslash( $_POST['user_login'] ) ); 377 377 $user_data = get_user_by( 'login', $login ); 378 378 } -
trunk/tests/phpunit/tests/auth.php
r46586 r46650 388 388 * @ticket 9568 389 389 */ 390 function test_log_in_using_email() {390 public function test_log_in_using_email() { 391 391 $user_args = array( 392 392 'user_login' => 'johndoe', … … 399 399 $this->assertInstanceOf( 'WP_User', wp_authenticate( $user_args['user_login'], $user_args['user_pass'] ) ); 400 400 } 401 402 /** 403 * @ticket 38744 404 */ 405 public function test_wp_signon_using_email_with_an_apostrophe() { 406 $user_args = array( 407 'user_email' => "mail\'@example.com", 408 'user_pass' => 'password', 409 ); 410 $this->factory()->user->create( $user_args ); 411 412 $_POST['log'] = $user_args['user_email']; 413 $_POST['pwd'] = $user_args['user_pass']; 414 $this->assertInstanceOf( 'WP_User', wp_signon() ); 415 } 416 401 417 } -
trunk/tests/phpunit/tests/user.php
r46643 r46650 36 36 self::$user_ids[] = self::$contrib_id; 37 37 38 self::$user_ids[] = $factory->user->create(39 array(40 'user_login' => "testemailaddress'@test.com",41 'user_nicename' => 'user_email_with_apostrophe',42 'user_pass' => 'password',43 'first_name' => 'John',44 'last_name' => 'Doe',45 'display_name' => 'John Doe',46 'user_email' => "testemailaddress'@test.com",47 'user_url' => 'http://tacos.com',48 'role' => 'contributor',49 'nickname' => 'Johnny',50 'description' => 'I am a WordPress user that cares about privacy.',51 )52 );53 54 38 self::$author_id = $factory->user->create( 55 39 array( … … 65 49 self::$editor_id = $factory->user->create( 66 50 array( 51 'user_email' => 'test@test.com', 67 52 'role' => 'editor', 68 'user_email' => 'test@test.com',69 53 ) 70 54 ); … … 80 64 81 65 $this->author = clone self::$_author; 82 }83 84 public function test_that_you_can_login_with_an_email_that_has_apostrophe() {85 86 // Create the user with an email that has an apostrophe (see test setup).87 88 // Login as the user.89 $credentials = [90 'user_login' => "testemailaddress'@test.com",91 'user_password' => 'password',92 ];93 94 // Attempt to login.95 $user = wp_signon( $credentials );96 97 // Assert that the login was successfull.98 // If the login fails, an instance of WP_Error is returned rather than User object.99 $this->assertNotWPError( $user );100 66 } 101 67
Note: See TracChangeset
for help on using the changeset viewer.