You are here

public function HttpblWhitelistForm::submitForm in http:BL 8

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormInterface::submitForm

File

src/Form/HttpblWhitelistForm.php, line 191

Class

HttpblWhitelistForm
Displays banned IP addresses.

Namespace

Drupal\httpbl\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {

  // Unset the White-list Challenge
  if (isset($_SESSION['httpbl_challenge'])) {
    unset($_SESSION['httpbl_challenge']);
  }

  // Set this visitor as Session White-listed
  $_SESSION['httpbl_status'] = 'session_whitelisted';
  drupal_set_message(t('Success! Your current session has been white-listed.'), 'status', FALSE);

  // Setup redirect to original request Uri
  $url = Url::fromRoute('<front>');
  $form_state
    ->setRedirectUrl($url);
}