public function TfaTestTotp::validateForm in Two-factor Authentication (TFA) 7.2
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
- tests/
includes/ tfa_test.totp.inc, line 47 - Tests for the TfaValidationPluginInterface.
Class
- TfaTestTotp
- Class TfaTestTotp.
Code
public function validateForm(array $form, array &$form_state) {
$this->code = variable_get('tfa_totp', 123456);
if (!parent::validate($form_state['values']['code'])) {
$this->errorMessages['code'] = t('Invalid TOTP code');
return FALSE;
}
else {
return TRUE;
}
}