You are here

public function MobileNumberTfa::validateForm in Mobile Number 7

Validate form callback.

Overrides TfaValidationPluginInterface::validateForm

File

src/MobileNumberTfa.php, line 108
Contains MobileNumberTfa.

Class

MobileNumberTfa
Class MobileNumberTfa is a validation and sending plugin for TFA.

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 (!$this
    ->verifyCode($form_state['values']['code'])) {
    $this->errorMessages['code'] = t('Invalid code.');
    return FALSE;
  }
  else {
    return TRUE;
  }
}