1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-14 04:30:29 +01:00

[ticket/16004] Add check-in for Emojis in Username

PHPBB3-16004
This commit is contained in:
3D-I 2019-03-31 07:08:20 +02:00
parent e6ac4daf64
commit dc80ffdb40
2 changed files with 8 additions and 0 deletions

View File

@ -1760,6 +1760,13 @@ function validate_username($username, $allowed_username = false)
return 'USERNAME_TAKEN';
}
// Check for out-of-bounds characters that are currently
// not supported by utf8_bin in MySQL
if (preg_match('/[\x{10000}-\x{10FFFF}]/u', $username))
{
return 'INVALID_EMOJIS_USERNAME';
}
$sql = 'SELECT group_name
FROM ' . GROUPS_TABLE . "
WHERE LOWER(group_name) = '" . $db->sql_escape(utf8_strtolower($username)) . "'";

View File

@ -272,6 +272,7 @@ $lang = array_merge($lang, array(
'IMPORTANT_NEWS' => 'Important announcements',
'INVALID_USER_BIRTHDAY' => 'The entered birthday is not a valid date.',
'INVALID_CHARS_USERNAME' => 'The username contains forbidden characters.',
'INVALID_EMOJIS_USERNAME' => 'The username contains forbidden characters (Emoji).',
'INVALID_CHARS_NEW_PASSWORD'=> 'The password does not contain the required characters.',
'ITEMS_REQUIRED' => 'The items marked with * are required profile fields and need to be filled out.',