From 589161219ff2abb4c78924cddd27eda3d8e97685 Mon Sep 17 00:00:00 2001 From: Joshua Ramon Enslin Date: Wed, 9 Mar 2022 00:16:55 +0100 Subject: [PATCH] Require numbers OR special chars for passwords, not AND --- src/MD_STD_IN.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/MD_STD_IN.php b/src/MD_STD_IN.php index e0e0c83..94f84c9 100644 --- a/src/MD_STD_IN.php +++ b/src/MD_STD_IN.php @@ -244,11 +244,8 @@ final class MD_STD_IN { $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;