You are here

function tfa_form in Two-factor Authentication (TFA) 7.2

Main TFA process form builder.

Invokes plugin getForm() and handles multi-step fallback.

1 string reference to 'tfa_form'
tfa_begin_form in ./tfa.form.inc
Start of TFA process form.

File

./tfa.form.inc, line 23
Form-related functions.

Code

function tfa_form($form, $form_state, $account) {
  $tfa = tfa_get_process($account);

  // Check flood tables.
  if (_tfa_hit_flood($tfa)) {
    module_invoke_all('tfa_flood_hit', $tfa
      ->getContext());
    return drupal_access_denied();
  }

  // Get TFA plugins form.
  $form = $tfa
    ->getForm($form, $form_state);
  if ($tfa
    ->hasFallback()) {
    $form['actions']['fallback'] = array(
      '#type' => 'submit',
      '#value' => t("Can't access your account?"),
      '#submit' => array(
        'tfa_form_submit',
      ),
      '#limit_validation_errors' => array(),
      '#weight' => 20,
    );
  }

  // Set account element.
  $form['account'] = array(
    '#type' => 'value',
    '#value' => $account,
  );
  return $form;
}