WordPress.org

Make WordPress Core

Ticket #39645: 39645.diff

File 39645.diff, 1.2 KB (added by Presskopp, 4 years ago)
  • wp-includes/user.php

     
    22792279        // Check the username
    22802280        if ( $sanitized_user_login == '' ) {
    22812281                $errors->add( 'empty_username', __( '<strong>ERROR</strong>: Please enter a username.' ) );
     2282        } elseif ( $sanitized_user_login == 'admin' || $sanitized_user_login == 'Admin') {
     2283                // Don't let somebody fake an admin account
     2284                $errors->add( 'invalid_username', __( '<strong>ERROR</strong>: Cheatin&#8217; uh?' ) );
    22822285        } elseif ( ! validate_username( $user_login ) ) {
    22832286                $errors->add( 'invalid_username', __( '<strong>ERROR</strong>: This username is invalid because it uses illegal characters. Please enter a valid username.' ) );
    22842287                $sanitized_user_login = '';
    22852288        } elseif ( username_exists( $sanitized_user_login ) ) {
    22862289                $errors->add( 'username_exists', __( '<strong>ERROR</strong>: This username is already registered. Please choose another one.' ) );
    2287 
    22882290        } else {
    22892291                /** This filter is documented in wp-includes/user.php */
    22902292                $illegal_user_logins = array_map( 'strtolower', (array) apply_filters( 'illegal_user_logins', array() ) );