From e40ea418f41e94857b0f5a3e00cb50e863bf17c9 Mon Sep 17 00:00:00 2001 From: "[Peter Burnett]" <[peterburnett@catalyst-au.net]> Date: Tue, 30 Jul 2019 14:49:42 +1000 Subject: [PATCH] MDL-66280 core: Added checks for empty password minimum length --- lib/weblib.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/weblib.php b/lib/weblib.php index 73fbcf94a2a..406b6b25750 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -3615,7 +3615,9 @@ function print_password_policy() { $message = ''; if (!empty($CFG->passwordpolicy)) { $messages = array(); - $messages[] = get_string('informminpasswordlength', 'auth', $CFG->minpasswordlength); + if (!empty($CFG->minpasswordlength)) { + $messages[] = get_string('informminpasswordlength', 'auth', $CFG->minpasswordlength); + } if (!empty($CFG->minpassworddigits)) { $messages[] = get_string('informminpassworddigits', 'auth', $CFG->minpassworddigits); } @@ -3630,7 +3632,10 @@ function print_password_policy() { } $messages = join(', ', $messages); // This is ugly but we do not have anything better yet... - $message = get_string('informpasswordpolicy', 'auth', $messages); + // Check if messages is empty before outputting any text. + if ($messages != '') { + $message = get_string('informpasswordpolicy', 'auth', $messages); + } } return $message; } -- 2.43.0