You are here

public function TfaLoginForm::tfaLoginFormRedirect in Two-factor Authentication (TFA) 8

Login submit handler for TFA form redirection.

Should be last invoked form submit handler for forms user_login and user_login_block so that when the TFA process is applied the user will be sent to the TFA form.

Parameters

array $form: The current form api array.

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

File

src/Form/TfaLoginForm.php, line 256

Class

TfaLoginForm
TFA user login form.

Namespace

Drupal\tfa\Form

Code

public function tfaLoginFormRedirect(array $form, FormStateInterface $form_state) {
  $route = $form_state
    ->getValue('tfa_redirect');
  if (isset($route)) {
    $form_state
      ->setRedirect($route);
  }
}