/** * Create a system-generated password or password-like code, meeting the configured constraints for a password. * * @return string The generated (unhashed) password-like string. */ public static function generatePassword() { $minLength = ModUtil::getVar('Users', 'minpass', 5); if (!is_numeric($minLength) || (int) $minLength != $minLength || $minLength < 5) { $minLength = 5; } $minLength = min($minLength, 25); $maxLength = min($minLength + 3, 25); return RandomUtil::getStringForPassword($minLength, $maxLength); }