diff --git a/public/main/inc/lib/api.lib.php b/public/main/inc/lib/api.lib.php index 4c6305471d..f61a262284 100644 --- a/public/main/inc/lib/api.lib.php +++ b/public/main/inc/lib/api.lib.php @@ -2231,7 +2231,7 @@ function api_generate_password(int $length = 8, $useRequirements = true): string $factory = new RandomLib\Factory(); $generator = $factory->getGenerator(new SecurityLib\Strength(SecurityLib\Strength::MEDIUM)); - if (is_array($passwordRequirements)) { + if (!empty($passwordRequirements)) { $length = $passwordRequirements['min']['length']; $minNumbers = $passwordRequirements['min']['numeric']; $minLowerCase = $passwordRequirements['min']['lowercase']; diff --git a/public/main/inc/lib/security.lib.php b/public/main/inc/lib/security.lib.php index f0590ced22..51297dbd3f 100644 --- a/public/main/inc/lib/security.lib.php +++ b/public/main/inc/lib/security.lib.php @@ -548,7 +548,7 @@ class Security ]; $passwordRequirements = api_get_setting('security.password_requirements', true); - if (is_array($passwordRequirements)) { + if (!empty($passwordRequirements)) { $requirements = $passwordRequirements; }