Password can now contain any characters

Also added limit of 29 characters (client limitation)
This commit is contained in:
slawkens 2020-12-30 00:10:11 +01:00
parent ff9e255f1b
commit 40722c8c30
2 changed files with 5 additions and 15 deletions

View File

@ -147,18 +147,8 @@ class Validator
return false;
}
if (strlen($password) < 8 || strlen($password) > 30) {
self::$lastError = 'The password must have at least 8 and maximum 30 letters!';
return false;
}
if(strspn($password, "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890") != strlen($password)) {
self::$lastError = 'Password contains illegal letters (a-z, A-Z and 0-9 only!).';
return false;
}
if(!ctype_alnum($password)) {
self::$lastError = 'Password contains illegal letters (a-z, A-Z and 0-9 only!).';
if (strlen($password) < 8 || strlen($password) > 29) {
self::$lastError = 'The password must have at least 8 and maximum 29 letters!';
return false;
}
@ -168,7 +158,7 @@ class Validator
}
if(!preg_match('/[0-9]/', $password)) {
self::$lastError = 'The password must contain at least one letter other than A-Z or a-z!';
self::$lastError = 'The password must contain at least one number!';
return false;
}

View File

@ -86,7 +86,7 @@
<span{% if errors.password is defined %} class="red"{% endif %}>Password:</span>
</td>
<td>
<input type="password" name="password" id="password" value="" size="30" maxlength="50" />
<input type="password" name="password" id="password" value="" size="30" maxlength="29" />
<img id="password_indicator" src="images/global/general/{% if not save or errors.password is defined %}n{% endif %}ok.gif" style="display: none;" />
</td>
</tr>
@ -96,7 +96,7 @@
<span{% if errors.password is defined %} class="red"{% endif %}>Repeat password:</span>
</td>
<td>
<input type="password" name="password2" id="password2" value="" size="30" maxlength="50" />
<input type="password" name="password2" id="password2" value="" size="30" maxlength="29" />
<img id="password2_indicator" src="images/global/general/{% if not save or errors.password is defined %}n{% endif %}ok.gif" style="display: none;" />
</td>
</tr>