Do not allow the creation of an administrator remotely

Here is a short script that prevents unapproved admins from logging in. Of course it is possible to add multiple login names.

add_filter( 'authenticate', 'auth_signon', 30, 3 );
function auth_signon( $user, $username, $password ) {
    if( strtoupper($username) !== 'MYLOGINNAME' && in_array( 'administrator', (array) $user->roles )){
         wp_logout();
         return new WP_Error( 'broke', __( $username . ", good try, but you are not an administrator"  , "text_domain" ) );
        exit;
    }else{
        return $user;   
    }
}

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)