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;
}