diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index ae64fd37ed..dc08a766a3 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -790,7 +790,7 @@ class acp_users $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); } - $user_char_ary = array('.*' => 'USERNAME_CHARS_ANY', '[\w]+' => 'USERNAME_ALPHA_ONLY', '[\w_\+\. \-\[\]]+' => 'USERNAME_ALPHA_SPACERS'); + $user_char_ary = array('.*' => 'USERNAME_CHARS_ANY', '[a-z]+' => 'USERNAME_ALPHA_ONLY', '[-\]_+ [a-z]+' => 'USERNAME_ALPHA_SPACERS', '\w+' => 'USERNAME_LETTER_NUM', '[-\]_+ [\w]+' => 'USERNAME_LETTER_NUM_SPACERS'); $pass_char_ary = array('.*' => 'PASS_TYPE_ANY', '[a-zA-Z]' => 'PASS_TYPE_CASE', '[a-zA-Z0-9]' => 'PASS_TYPE_ALPHA', '[a-zA-Z\W]' => 'PASS_TYPE_SYMBOL'); if ($user_id == $user->data['user_id']) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 1d11f00298..a8fb455cdf 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1148,7 +1148,7 @@ function validate_username($username) return false; } - if (!preg_match('#^' . str_replace('\\\\', '\\', $config['allow_name_chars']) . '$#i', $username) || strpos($username, '"') !== false || strpos($username, '"') !== false) + if (!preg_match('#^' . str_replace('\\\\', '\\', $config['allow_name_chars']) . '$#ui', $username) || strpos($username, '"') !== false || strpos($username, '"') !== false) { return 'INVALID_CHARS'; } diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index b8d5c438a7..37d44958bc 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -478,7 +478,7 @@ class ucp_register break; } - $user_char_ary = array('.*' => 'USERNAME_CHARS_ANY', '[\w]+' => 'USERNAME_ALPHA_ONLY', '[\w_\+\. \-\[\]]+' => 'USERNAME_ALPHA_SPACERS'); + $user_char_ary = array('.*' => 'USERNAME_CHARS_ANY', '[a-z]+' => 'USERNAME_ALPHA_ONLY', '[-\]_+ [a-z]+' => 'USERNAME_ALPHA_SPACERS', '\w+' => 'USERNAME_LETTER_NUM', '[-\]_+ [\w]+' => 'USERNAME_LETTER_NUM_SPACERS'); $pass_char_ary = array('.*' => 'PASS_TYPE_ANY', '[a-zA-Z]' => 'PASS_TYPE_CASE', '[a-zA-Z0-9]' => 'PASS_TYPE_ALPHA', '[a-zA-Z\W]' => 'PASS_TYPE_SYMBOL'); // diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 97cf8ad8b6..febd88665f 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -569,6 +569,17 @@ if (version_compare($current_version, '3.0.b4', '<=')) set_config('newest_user_colour', $row['user_colour'], true); + switch ($config['allow_name_chars']) + { + case '[\w]+': + set_config('allow_name_chars', '[a-z]+'); + break; + + case '[\w_\+\. \-\[\]]+': + set_config('allow_name_chars', '[-\]_+ [a-z]+'); + break; + } + $no_updates = false; } diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 02dabb9775..6270987935 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -204,6 +204,8 @@ $lang = array_merge($lang, array( 'REG_LIMIT_EXPLAIN' => 'Number of attempts users can make at the confirmation code before being locked out that session.', 'USERNAME_ALPHA_ONLY' => 'Alphanumeric only', 'USERNAME_ALPHA_SPACERS' => 'Alphanumeric and spacers', + 'USERNAME_LETTER_NUM' => 'Any letter and number', + 'USERNAME_LETTER_NUM_SPACERS' => 'Any letter, number, and spacer', 'USERNAME_CHARS' => 'Limit username chars', 'USERNAME_CHARS_ANY' => 'Any character', 'USERNAME_CHARS_EXPLAIN' => 'Restrict type of characters that may be used in usernames, spacers are; space, -, +, _, [ and ]', diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index 92d5225743..b336bca739 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -453,6 +453,8 @@ $lang = array_merge($lang, array( 'UPLOAD_AVATAR_URL_EXPLAIN' => 'Enter the URL of the location containing the image, it will be copied to this site.', 'USERNAME_ALPHA_ONLY_EXPLAIN' => 'Username must be between %1$d and %2$d chars long and use only alphanumeric characters', 'USERNAME_ALPHA_SPACERS_EXPLAIN'=> 'Username must be between %1$d and %2$d chars long and use alphanumeric, space or -+_[] characters.', + 'USERNAME_LETTER_NUM_EXPLAIN' => 'Username must be between %1$d and %2$d chars long and use only letter or number characters', + 'USERNAME_LETTER_NUM_SPACERS_EXPLAIN'=> 'Username must be between %1$d and %2$d chars long and use letter, number, space or -+_[] characters.', 'USERNAME_CHARS_ANY_EXPLAIN' => 'Length must be between %1$d and %2$d characters.', 'USERNAME_TAKEN_USERNAME' => 'The username you entered is already in use, please select an alternative.', 'USERNAME_DISALLOWED_USERNAME' => 'The username you entered has been banned.',