From 004add5e820c96f2384d1c793041a224f4ae7044 Mon Sep 17 00:00:00 2001 From: mensonge Date: Thu, 15 Jan 2009 17:19:45 +0000 Subject: [PATCH] Interface Fix: too short username are forbidden during registration git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@236 b3834d28-1941-0410-a4f8-b48e95affb8f --- register.php | 2 +- services/userservice.php | 4 +++- 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) {