You are here

public function TfaBasicSms::validateForm in TFA Basic plugins 7

Validate form.

Parameters

array $form: The form array structure.

array $form_state: The current form state array.

Return value

bool Whether form passes validation or not.

Overrides TfaValidationPluginInterface::validateForm

File

includes/tfa_sms.inc, line 67

Class

TfaBasicSms

Code

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

  // If operation is resend then do not attempt to validate code.
  if ($form_state['values']['op'] === $form_state['values']['resend']) {
    return TRUE;
  }
  elseif (!parent::validate($form_state['values']['code'])) {
    $this->errorMessages['code'] = t('Invalid code.');
    return FALSE;
  }
  else {
    return TRUE;
  }
}