User: Show password requirement when password rules is set - refs BT#20083

pull/4352/head
Angel Fernando Quiroz Campos 3 years ago
parent 46ab447f4c
commit 328bada615
  1. 9
      main/inc/lib/formvalidator/FormValidator.class.php
  2. 7
      main/inc/lib/pear/HTML/QuickForm/element.php
  3. 4
      main/inc/lib/security.lib.php

@ -1647,6 +1647,15 @@ EOT;
'api_check_password' 'api_check_password'
); );
} }
if (!$this->isSubmitted()) {
$element = $this->getElement($elementName);
$label = $element->getLabel();
$element->setLabel([
$label,
Security::getPasswordRequirementsToString(),
]);
}
} }
} }

@ -350,9 +350,10 @@ class HTML_QuickForm_element extends HTML_Common
/** /**
* Sets display text for the element * Sets display text for the element
* *
* @param string $label Display text for the element * @param string|array $label Display text for the element
* @param string $label_for Optionally add a "for" attribute * @param string|null $labelFor Optionally add a "for" attribute
* @since 1.3 *
* @since 1.3
*/ */
public function setLabel($label, $labelFor = null) public function setLabel($label, $labelFor = null)
{ {

@ -575,7 +575,7 @@ class Security
* Gets password requirements in the platform language using get_lang * Gets password requirements in the platform language using get_lang
* based in platform settings. See function 'self::getPasswordRequirements'. * based in platform settings. See function 'self::getPasswordRequirements'.
*/ */
public static function getPasswordRequirementsToString(array $evaluatedConditions): string public static function getPasswordRequirementsToString(array $evaluatedConditions = []): string
{ {
$output = ''; $output = '';
$setting = self::getPasswordRequirements(); $setting = self::getPasswordRequirements();
@ -610,7 +610,7 @@ class Security
$icon = $pendingIcon; $icon = $pendingIcon;
} }
$output .= $icon; $output .= empty($evaluatedConditions) ? '' : $icon;
$output .= sprintf( $output .= sprintf(
get_lang( get_lang(
'NewPasswordRequirement'.ucfirst($type).'X'.ucfirst($rule) 'NewPasswordRequirement'.ucfirst($type).'X'.ucfirst($rule)

Loading…
Cancel
Save