From e5cc03cbc30df8e1a2231adef152973807ef508f Mon Sep 17 00:00:00 2001 From: SilicaAndPina Date: Thu, 13 May 2021 12:16:47 +1200 Subject: [PATCH] Add username capitializeation requirements --- WebInterface/master-site/web/newuser.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/WebInterface/master-site/web/newuser.php b/WebInterface/master-site/web/newuser.php index e646714..42c180f 100755 --- a/WebInterface/master-site/web/newuser.php +++ b/WebInterface/master-site/web/newuser.php @@ -39,16 +39,20 @@ if(isset($_POST['cbt'], $_POST['user'],$_POST['pass1'],$_POST['pass2'],$_POST['s $country = $_POST['country']; $gender = $_POST['sex']; - // Check for non-letters in name if(preg_match('/[^A-Za-z]/', $username)) array_push($problems, "Username must contain ONLY Letters."); - // Check for too short + $username_len = strlen($username); if($username_len < 3) array_push($problems, "Username must be at least 3 characters long."); if($username_len > 16) array_push($problems, "Username must be less than 16 characters long."); + if(preg_match('/[A-Z]{2,}/',$username)) + array_push($problems, "Username should be formatted with the first letter of each word capitalized. ( For example: BlueBunny )"); + + if(strtoupper($username)[0] !== $username[0]) + array_push($problems, "Username should be formatted with the first letter of each word capitalized. ( For example: BlueBunny )"); if(preg_match('/[^A-Za-z0-9]/',$password)) array_push($problems, "Password must contain ONLY Letters and numbers.");