diff --git a/services/userservice.php b/services/userservice.php index e50faaa..9b295da 100644 --- a/services/userservice.php +++ b/services/userservice.php @@ -393,8 +393,9 @@ class UserService { if (strlen($username) > 24) { // too long usernames are cut by database and may cause bugs when compared return false; - } else { - return true; + } elseif (preg_match('/(\W)/', $username) > 0) { + // forbidden non-alphanumeric characters + return false; } return true; } diff --git a/templates/editprofile.tpl.php b/templates/editprofile.tpl.php index c9eb8a4..a38dbd8 100644 --- a/templates/editprofile.tpl.php +++ b/templates/editprofile.tpl.php @@ -40,7 +40,7 @@ $this->includeTemplate($GLOBALS['top_include']);