summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--register.php2
-rw-r--r--services/userservice.php4
2 files changed, 4 insertions, 2 deletions
diff --git a/register.php b/register.php
index 9bee1db..bc1196a 100644
--- a/register.php
+++ b/register.php
@@ -49,7 +49,7 @@ if (POST_SUBMITTED != '') {
// Check if username is valid (length, authorized characters)
} elseif (!$userservice->isValidUsername($posteduser)) {
- $tplVars['error'] = T_('This username is not valid (too long, forbidden characters...), please make another choice.');
+ $tplVars['error'] = T_('This username is not valid (too short, too long, forbidden characters...), please make another choice.');
// Check if e-mail address is valid
} elseif (!$userservice->isValidEmail(POST_MAIL)) {
diff --git a/services/userservice.php b/services/userservice.php
index ad79d34..fa0d5c9 100644
--- a/services/userservice.php
+++ b/services/userservice.php
@@ -445,7 +445,9 @@ class UserService {
}
function isValidUsername($username) {
- if (strlen($username) > 24) {
+ if (strlen($username) < 4) {
+ return false;
+ }elseif (strlen($username) > 24) {
// too long usernames are cut by database and may cause bugs when compared
return false;
} elseif (preg_match('/(\W)/', $username) > 0) {