You are here

public function TfaBasicSms::submitForm in TFA Basic plugins 7

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

includes/tfa_sms.inc, line 81

Class

TfaBasicSms

Code

public function submitForm(array $form, array &$form_state) {

  // Resend code if pushed.
  if ($form_state['values']['op'] === $form_state['values']['resend']) {
    $this->code = $this
      ->generate();
    if (!$this
      ->sendCode($this->code)) {
      drupal_set_message(t('Unable to deliver the code. Please contact support.'), 'error');
    }
    else {
      drupal_set_message(t('Code resent'));
    }
    return FALSE;
  }
  else {
    return parent::submitForm($form, $form_state);
  }
}