Changeset 35629
- Timestamp:
- 11/12/2015 04:29:45 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/user.php
r35190 r35629 144 144 145 145 /** This filter is documented in wp-includes/user-functions.php */ 146 if ( in_array( $user->user_login, apply_filters( 'illegal_user_logins', array() ) ) ) { 146 $illegal_logins = apply_filters( 'illegal_user_logins', array() ); 147 148 if ( in_array( strtolower( $user->user_login ), array_map( 'strtolower', $illegal_logins ) ) ) { 147 149 $errors->add( 'illegal_user_login', __( '<strong>ERROR</strong>: Sorry, that username is not allowed.' ) ); 148 150 } -
trunk/src/wp-includes/ms-functions.php
r35325 r35629 433 433 434 434 /** This filter is documented in wp-includes/user-functions.php */ 435 if ( in_array( $user_name, apply_filters( 'illegal_user_logins', array() ) ) ) { 435 $illegal_logins = apply_filters( 'illegal_user_logins', array() ); 436 437 if ( in_array( strtolower( $user_name ), array_map( 'strtolower', $illegal_logins ) ) ) { 436 438 $errors->add( 'user_name', __( 'Sorry, that username is not allowed.' ) ); 437 439 } -
trunk/src/wp-includes/user-functions.php
r35618 r35629 1329 1329 * @param array $usernames Array of blacklisted usernames. 1330 1330 */ 1331 if ( in_array( $user_login, apply_filters( 'illegal_user_logins', array() ) ) ) { 1331 $illegal_logins = apply_filters( 'illegal_user_logins', array() ); 1332 1333 if ( in_array( strtolower( $user_login ), array_map( 'strtolower', $illegal_logins ) ) ) { 1332 1334 return new WP_Error( 'illegal_user_login', __( 'Sorry, that username is not allowed.' ) ); 1333 1335 } -
trunk/tests/phpunit/tests/user.php
r35618 r35629 596 596 /** 597 597 * @ticket 27317 598 */ 599 function test_illegal_user_logins_single() { 598 * @dataProvider _illegal_user_logins_data 599 */ 600 function test_illegal_user_logins_single( $user_login ) { 600 601 $user_data = array( 601 'user_login' => 'testuser',602 'user_login' => $user_login, 602 603 'user_email' => 'testuser@example.com', 603 604 'user_pass' => wp_generate_password(), … … 619 620 /** 620 621 * @ticket 27317 621 */ 622 function test_illegal_user_logins_multisite() { 622 * @dataProvider _illegal_user_logins_data 623 */ 624 function test_illegal_user_logins_multisite( $user_login ) { 623 625 if ( ! is_multisite() ) { 624 626 return; … … 626 628 627 629 $user_data = array( 628 'user_login' => 'testuser',630 'user_login' => $user_login, 629 631 'user_email' => 'testuser@example.com', 630 632 ); … … 641 643 $this->assertInstanceOf( 'WP_Error', $response['errors'] ); 642 644 $this->assertEquals( 0, count( $response['errors']->get_error_codes() ) ); 645 } 646 647 function _illegal_user_logins_data() { 648 return array( 649 array( 'testuser' ), 650 array( 'TestUser' ), 651 ); 643 652 } 644 653
Note: See TracChangeset
for help on using the changeset viewer.