function UserLoginForm::validateName
Same name in other branches
- 9 core/modules/user/src/Form/UserLoginForm.php \Drupal\user\Form\UserLoginForm::validateName()
- 10 core/modules/user/src/Form/UserLoginForm.php \Drupal\user\Form\UserLoginForm::validateName()
Sets an error if supplied username has been blocked.
File
-
core/
modules/ user/ src/ Form/ UserLoginForm.php, line 153
Class
- UserLoginForm
- Provides a user login form.
Namespace
Drupal\user\FormCode
public function validateName(array &$form, FormStateInterface $form_state) {
if (!$form_state->isValueEmpty('name') && user_is_blocked($form_state->getValue('name'))) {
// Blocked in user administration.
$form_state->setErrorByName('name', $this->t('The username %name has not been activated or is blocked.', [
'%name' => $form_state->getValue('name'),
]));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.