You are here

public function ConfigForm::validateForm in Auto Login URL 8

Same name and namespace in other branches
  1. 2.x src/Form/ConfigForm.php \Drupal\auto_login_url\Form\ConfigForm::validateForm()

Implements \Drupal\Core\Form\FormInterface::validateForm().

Overrides FormBase::validateForm

File

src/Form/ConfigForm.php, line 66

Class

ConfigForm

Namespace

Drupal\auto_login_url\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  parent::validateForm($form, $form_state);
  if ($form_state
    ->getValue('auto_login_url_expiration') < 1) {
    $form_state
      ->setErrorByName('auto_login_url_expiration', $this
      ->t('Expiration must be positive integer.'));
  }
  if ($form_state
    ->getValue('auto_login_url_token_length') < 8 || $form_state
    ->getValue('auto_login_url_token_length') > 64) {
    $form_state
      ->setErrorByName('auto_login_url_token_length', $this
      ->t('Token length has to be between 6 and 64 digits.'));
  }
}