Require numbers OR special chars for passwords, not AND

This commit is contained in:
jrenslin committed 2022-03-09 00:16:55 +01:00
1 parent e18b649250
commit 589161219f
1 file changed
+2 -5
+2 -5
View File
@@ -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;