You are here

public function SocialUserLoginForm::validateNameMail in Open Social 8.9

Same name and namespace in other branches
  1. 8 modules/social_features/social_user/src/Form/SocialUserLoginForm.php \Drupal\social_user\Form\SocialUserLoginForm::validateNameMail()
  2. 8.2 modules/social_features/social_user/src/Form/SocialUserLoginForm.php \Drupal\social_user\Form\SocialUserLoginForm::validateNameMail()
  3. 8.3 modules/social_features/social_user/src/Form/SocialUserLoginForm.php \Drupal\social_user\Form\SocialUserLoginForm::validateNameMail()
  4. 8.4 modules/social_features/social_user/src/Form/SocialUserLoginForm.php \Drupal\social_user\Form\SocialUserLoginForm::validateNameMail()
  5. 8.5 modules/social_features/social_user/src/Form/SocialUserLoginForm.php \Drupal\social_user\Form\SocialUserLoginForm::validateNameMail()
  6. 8.6 modules/social_features/social_user/src/Form/SocialUserLoginForm.php \Drupal\social_user\Form\SocialUserLoginForm::validateNameMail()
  7. 8.7 modules/social_features/social_user/src/Form/SocialUserLoginForm.php \Drupal\social_user\Form\SocialUserLoginForm::validateNameMail()
  8. 8.8 modules/social_features/social_user/src/Form/SocialUserLoginForm.php \Drupal\social_user\Form\SocialUserLoginForm::validateNameMail()
  9. 10.3.x modules/social_features/social_user/src/Form/SocialUserLoginForm.php \Drupal\social_user\Form\SocialUserLoginForm::validateNameMail()
  10. 10.0.x modules/social_features/social_user/src/Form/SocialUserLoginForm.php \Drupal\social_user\Form\SocialUserLoginForm::validateNameMail()
  11. 10.1.x modules/social_features/social_user/src/Form/SocialUserLoginForm.php \Drupal\social_user\Form\SocialUserLoginForm::validateNameMail()
  12. 10.2.x modules/social_features/social_user/src/Form/SocialUserLoginForm.php \Drupal\social_user\Form\SocialUserLoginForm::validateNameMail()

Sets an error if supplied username or mail has been blocked.

File

modules/social_features/social_user/src/Form/SocialUserLoginForm.php, line 136

Class

SocialUserLoginForm
Class SocialUserLoginForm.

Namespace

Drupal\social_user\Form

Code

public function validateNameMail(array &$form, FormStateInterface $form_state) {
  $user_blocked = social_user_is_blocked($form_state
    ->getValue('name_or_mail'));
  if ($user_blocked) {

    // Blocked in user administration.
    if (!$form_state
      ->get('uid')) {
      $this
        ->setGeneralErrorMessage($form, $form_state);
    }
    else {
      $form_state
        ->setErrorByName('name_or_mail', $this
        ->t('The username %name has not been activated or is blocked.', [
        '%name' => $form_state
          ->getValue('name_or_mail'),
      ]));
    }
  }
}