Require numbers OR special chars for passwords, not AND
This commit is contained in:
1 file changed
+2
-5
+2
-5
@@ -244,11 +244,8 @@ public static function validate_password(string $input):array {
|
||||
$errors[] = 'password_too_short';
|
||||
}
|
||||
|
||||
if ((\preg_match('@[0-9]@', $input)) === false) {
|
||||
$errors[] = 'password_has_no_number';
|
||||
}
|
||||
if ((\preg_match('@[^\w]@', $input)) === false) {
|
||||
$errors[] = 'password_has_no_special_char';
|
||||
if (!(\preg_match('@[0-9]@', $input)) && !(\preg_match('@[^\w]@', $input))) {
|
||||
$errors[] = 'password_has_no_number_no_special_char';
|
||||
}
|
||||
|
||||
return $errors;
|
||||
|
||||
Reference in new issue
Block a user