You are here

public function ProtectedPagesLoginForm::submitForm in Protected Pages 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/ProtectedPagesLoginForm.php, line 194

Class

ProtectedPagesLoginForm
Provides login screen to access protected page.

Namespace

Drupal\protected_pages\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('protected_pages.settings');
  $_SESSION['_protected_page']['passwords'][$form_state
    ->getValue('protected_page_pid')]['request_time'] = $this->time
    ->getRequestTime();
  $session_expire_time = $config
    ->get('password.protected_pages_session_expire_time');
  if ($session_expire_time) {
    $_SESSION['_protected_page']['passwords'][$form_state
      ->getValue('protected_page_pid')]['expire_time'] = strtotime("+{$session_expire_time} minutes");
  }
}