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'
);
}
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
*
* @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)
{

@ -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)

Loading…
Cancel
Save