Accept dashes and spaces in names
Change-Id: Ie3729175c1f739bb0be4402e9be1e2a1921da752
diff --git a/templates/register.htm b/templates/register.htm
index 87033c0..a8c6a77 100644
--- a/templates/register.htm
+++ b/templates/register.htm
@@ -53,20 +53,20 @@
<div class="col-md-4">
<div class="form-outline">
<label class="form-label fw-bold" for="form3Example1">First name</label>
- <input pattern="[^\s]{<?php echo $VAL_USER->min_first_name.','.$VAL_USER->max_first_name;?>}" required title="At least 2 not whitespace characters" name="first_name" type="text" id="form3Example1" class="form-control fs-4 <?php if(isset($error) && $error && !isset($_POST['first_name'])){echo 'border-danger';}?>"
+ <input pattern="[^\s].{<?php echo ($VAL_USER->min_first_name - 1) . ','.$VAL_USER->max_first_name;?>}" required title="At least 2 not whitespace characters" name="first_name" type="text" id="form3Example1" class="form-control fs-4 <?php if(isset($error) && $error && !isset($_POST['first_name'])){echo 'border-danger';}?>"
placeholder="Jane" value="<?php echo isset($_POST['first_name']) ? htmlspecialchars($_POST['first_name']) : '' ?>" />
<div class="invalid-feedback">
- Please provide a first name with at least 2 characters.
+ Please provide a first name with at least <?php echo $VAL_USER->min_first_name ?> characters, not starting with white spaces.
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-outline">
<label class="form-label fs-4 fs-4 fw-bold" for="form3Example2">Last name</label>
- <input pattern="[^\s]{<?php echo $VAL_USER->min_last_name.','.$VAL_USER->max_last_name;?>}" required title="At least 2 not whitespace characters" name="last_name" type="text" id="form3Example2" class="form-control fs-4 <?php if(isset($error) && $error && !isset($_POST['last_name'])){echo 'border-danger';}?>"
+ <input pattern="[^\s].{<?php echo ($VAL_USER->min_last_name - 1). ','.$VAL_USER->max_last_name;?>}" required title="At least 2 not whitespace characters" name="last_name" type="text" id="form3Example2" class="form-control fs-4 <?php if(isset($error) && $error && !isset($_POST['last_name'])){echo 'border-danger';}?>"
placeholder="Doe" value="<?php echo isset($_POST['last_name']) ? htmlspecialchars($_POST['last_name']) : '' ?>" />
<div class="invalid-feedback">
- Please provide a last name with at least 2 characters.
+ Please provide a last name with at least <?php echo $VAL_USER->min_last_name ?> characters, not starting with white spaces.
</div>
</div>
</div>
diff --git a/templates/strings.php b/templates/strings.php
index 2bf82f9..405e353 100644
--- a/templates/strings.php
+++ b/templates/strings.php
@@ -9,7 +9,7 @@
$USERNAME_VALIDATION_ERROR = (object)[
"registered" => "This username is already in use! Please choose another username<br>",
- "no_whitespaces" => "Username cannot contain whitespaces<br>",
+ "no_whitespaces" => "Username cannot start with whitespaces<br>",
"smaller_than" => "Username must have less than {{num}} characters<br>",
"bigger_than" => "Username must be bigger than {{num}} characters<br>",
"no_special_chars" => "The username cannot contain special characters<br>",