You are here

function tfa_code_form_validate in Two-factor Authentication (TFA) 7

Same name and namespace in other branches
  1. 6 tfa.pages.inc \tfa_code_form_validate()

Validate handler for TFA login form.

File

./tfa.pages.inc, line 57
tfa.pages.inc

Code

function tfa_code_form_validate($form, &$form_state) {

  // Validate code.
  $code = tfa_get_code($form_state['values']['uid']);
  if ($code['code'] != $form_state['values']['code']) {
    form_set_error('code', t('Invalid code.'));

    // Register failure for purposes of flood control.
    flood_register_event('tfa_validate');
  }
}