From 40722c8c307f504113830e3bf161a9f937e407ee Mon Sep 17 00:00:00 2001 From: slawkens Date: Wed, 30 Dec 2020 00:10:11 +0100 Subject: [PATCH] Password can now contain any characters Also added limit of 29 characters (client limitation) --- system/libs/validator.php | 16 +++------------- system/templates/account.create.html.twig | 4 ++-- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/system/libs/validator.php b/system/libs/validator.php index 66ac3cc4..421d5fe6 100644 --- a/system/libs/validator.php +++ b/system/libs/validator.php @@ -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; } diff --git a/system/templates/account.create.html.twig b/system/templates/account.create.html.twig index a52119b7..8d9d57f9 100644 --- a/system/templates/account.create.html.twig +++ b/system/templates/account.create.html.twig @@ -86,7 +86,7 @@ Password: - + @@ -96,7 +96,7 @@ Repeat password: - +