You are here

function tfa_test_setup_form_validate in Two-factor Authentication (TFA) 7.2

Form validator.

File

tests/tfa_test.module, line 145
A mock module for testing TFA.

Code

function tfa_test_setup_form_validate($form, &$form_state) {
  if (empty($form_state['storage'])) {
    return;
  }
  $tfa_setup = $form_state['storage']['tfa_setup'];
  if (!$tfa_setup
    ->validateForm($form, $form_state)) {
    foreach ($tfa_setup
      ->getErrorMessages() as $element => $message) {
      form_set_error($element, $message);
    }
  }
}