You are here

public function TfaTestSendSetup::validateSetupForm in Two-factor Authentication (TFA) 7.2

Validate setup form.

Parameters

array $form: The form array structure.

array $form_state: The current form state array.

Return value

bool Indicates whether the form is valid.

Overrides TfaSetupPluginInterface::validateSetupForm

File

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

Class

TfaTestSendSetup
Class TfaTestSendSetup.

Code

public function validateSetupForm(array $form, array &$form_state) {
  if (!empty($form_state['values']['code']) && !$this
    ->validate($form_state['values']['code'])) {
    $this->errorMessages['code'] = t('Invalid code. Please try again.');
    return FALSE;
  }
  else {
    return TRUE;
  }
}