You are here

public function TfaTestSend::submitForm in Two-factor Authentication (TFA) 7.2

Submit form.

Parameters

array $form: The form array structure.

array $form_state: The current form state array.

Return value

bool Whether plugin form handling is complete. Plugins should return FALSE to invoke multi-step.

Overrides TfaBasePlugin::submitForm

File

tests/includes/tfa_test.send.inc, line 84
Tests for the TfaSendPluginInterface.

Class

TfaTestSend
Class TfaTestSend.

Code

public function submitForm(array $form, array &$form_state) {
  if ($form_state['values']['op'] === $form_state['values']['resend']) {

    // Register resend event for flood protection.
    flood_register_event('tfa_test_resend', 3600, $this->context['uid']);

    // Support causing send error.
    if (!variable_get('tfa_test_send_begin', TRUE)) {
      drupal_set_message(t('Error during resend'), 'error');
    }
    else {
      drupal_set_message(t('Code resent'));
    }
    return FALSE;
  }
  else {
    return parent::submitForm($form, $form_state);
  }
}