public function ConsecutiveCharacters::validateConfigurationForm in Password Policy 8.3
Form validation handler.
Parameters
array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().
Overrides PasswordConstraintBase::validateConfigurationForm
File
- password_policy_consecutive/
src/ Plugin/ PasswordConstraint/ ConsecutiveCharacters.php, line 72
Class
- ConsecutiveCharacters
- Enforces a maximum number of consecutive identical characters.
Namespace
Drupal\password_policy_consecutive\Plugin\PasswordConstraintCode
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
$types = $form_state
->getValue('max_consecutive_characters');
if (!is_numeric($types) || $types < 2) {
$form_state
->setErrorByName('max_consecutive_characters', $this
->t('The number of consecutive identical characters must be higher than 1 otherwise all passwords will fail.'));
}
}