From b08ae1d60bb43564c718621f022ec50900c368fa Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 12 Nov 2015 16:30:28 +0000 Subject: [PATCH] Users: After [35189], make `'illegal_user_logins'` check case-insensitive. Props juliobox. Fixes #27317. Built from https://develop.svn.wordpress.org/trunk@35629 git-svn-id: http://core.svn.wordpress.org/trunk@35593 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/user.php | 4 +++- wp-includes/ms-functions.php | 4 +++- wp-includes/user-functions.php | 4 +++- wp-includes/version.php | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/wp-admin/includes/user.php b/wp-admin/includes/user.php index 1d132b372f..bb68ad9c62 100644 --- a/wp-admin/includes/user.php +++ b/wp-admin/includes/user.php @@ -143,7 +143,9 @@ function edit_user( $user_id = 0 ) { $errors->add( 'user_login', __( 'ERROR: This username is already registered. Please choose another one.' )); /** This filter is documented in wp-includes/user-functions.php */ - if ( in_array( $user->user_login, apply_filters( 'illegal_user_logins', array() ) ) ) { + $illegal_logins = apply_filters( 'illegal_user_logins', array() ); + + if ( in_array( strtolower( $user->user_login ), array_map( 'strtolower', $illegal_logins ) ) ) { $errors->add( 'illegal_user_login', __( 'ERROR: Sorry, that username is not allowed.' ) ); } diff --git a/wp-includes/ms-functions.php b/wp-includes/ms-functions.php index 62a2d4e37a..d54a838e10 100644 --- a/wp-includes/ms-functions.php +++ b/wp-includes/ms-functions.php @@ -432,7 +432,9 @@ function wpmu_validate_user_signup($user_name, $user_email) { } /** This filter is documented in wp-includes/user-functions.php */ - if ( in_array( $user_name, apply_filters( 'illegal_user_logins', array() ) ) ) { + $illegal_logins = apply_filters( 'illegal_user_logins', array() ); + + if ( in_array( strtolower( $user_name ), array_map( 'strtolower', $illegal_logins ) ) ) { $errors->add( 'user_name', __( 'Sorry, that username is not allowed.' ) ); } diff --git a/wp-includes/user-functions.php b/wp-includes/user-functions.php index 89ee9c8574..1a71fcaaad 100644 --- a/wp-includes/user-functions.php +++ b/wp-includes/user-functions.php @@ -1328,7 +1328,9 @@ function wp_insert_user( $userdata ) { * * @param array $usernames Array of blacklisted usernames. */ - if ( in_array( $user_login, apply_filters( 'illegal_user_logins', array() ) ) ) { + $illegal_logins = apply_filters( 'illegal_user_logins', array() ); + + if ( in_array( strtolower( $user_login ), array_map( 'strtolower', $illegal_logins ) ) ) { return new WP_Error( 'illegal_user_login', __( 'Sorry, that username is not allowed.' ) ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 064396a80f..ecbc055408 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-beta4-35628'; +$wp_version = '4.4-beta4-35629'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.