diff --git a/main/inc/lib/formvalidator/FormValidator.class.php b/main/inc/lib/formvalidator/FormValidator.class.php index c506b9f1ee..c804c1eca5 100755 --- a/main/inc/lib/formvalidator/FormValidator.class.php +++ b/main/inc/lib/formvalidator/FormValidator.class.php @@ -1647,6 +1647,15 @@ EOT; 'api_check_password' ); } + + if (!$this->isSubmitted()) { + $element = $this->getElement($elementName); + $label = $element->getLabel(); + $element->setLabel([ + $label, + Security::getPasswordRequirementsToString(), + ]); + } } } diff --git a/main/inc/lib/pear/HTML/QuickForm/element.php b/main/inc/lib/pear/HTML/QuickForm/element.php index fcd5391736..edade5a54b 100755 --- a/main/inc/lib/pear/HTML/QuickForm/element.php +++ b/main/inc/lib/pear/HTML/QuickForm/element.php @@ -350,9 +350,10 @@ class HTML_QuickForm_element extends HTML_Common /** * Sets display text for the element * - * @param string $label Display text for the element - * @param string $label_for Optionally add a "for" attribute - * @since 1.3 + * @param string|array $label Display text for the element + * @param string|null $labelFor Optionally add a "for" attribute + * + * @since 1.3 */ public function setLabel($label, $labelFor = null) { diff --git a/main/inc/lib/security.lib.php b/main/inc/lib/security.lib.php index d9795ebbd6..07e7ee9137 100755 --- a/main/inc/lib/security.lib.php +++ b/main/inc/lib/security.lib.php @@ -575,7 +575,7 @@ class Security * Gets password requirements in the platform language using get_lang * based in platform settings. See function 'self::getPasswordRequirements'. */ - public static function getPasswordRequirementsToString(array $evaluatedConditions): string + public static function getPasswordRequirementsToString(array $evaluatedConditions = []): string { $output = ''; $setting = self::getPasswordRequirements(); @@ -610,7 +610,7 @@ class Security $icon = $pendingIcon; } - $output .= $icon; + $output .= empty($evaluatedConditions) ? '' : $icon; $output .= sprintf( get_lang( 'NewPasswordRequirement'.ucfirst($type).'X'.ucfirst($rule)