mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 12:50:28 +00:00
REST API: Use strict in_array() checks for the list of usernames blacklisted via illegal_user_logins filter.
See #48839. git-svn-id: https://develop.svn.wordpress.org/trunk@46804 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1584,7 +1584,7 @@ function wp_insert_user( $userdata ) {
|
||||
*/
|
||||
$illegal_logins = (array) apply_filters( 'illegal_user_logins', array() );
|
||||
|
||||
if ( in_array( strtolower( $user_login ), array_map( 'strtolower', $illegal_logins ) ) ) {
|
||||
if ( in_array( strtolower( $user_login ), array_map( 'strtolower', $illegal_logins ), true ) ) {
|
||||
return new WP_Error( 'invalid_username', __( 'Sorry, that username is not allowed.' ) );
|
||||
}
|
||||
|
||||
@@ -2503,7 +2503,7 @@ function register_new_user( $user_login, $user_email ) {
|
||||
} else {
|
||||
/** This filter is documented in wp-includes/user.php */
|
||||
$illegal_user_logins = (array) apply_filters( 'illegal_user_logins', array() );
|
||||
if ( in_array( strtolower( $sanitized_user_login ), array_map( 'strtolower', $illegal_user_logins ) ) ) {
|
||||
if ( in_array( strtolower( $sanitized_user_login ), array_map( 'strtolower', $illegal_user_logins ), true ) ) {
|
||||
$errors->add( 'invalid_username', __( '<strong>ERROR</strong>: Sorry, that username is not allowed.' ) );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user