function tfa_form_submit in Two-factor Authentication (TFA) 7.2
TFA form submission handler.
Invokes plugin submitForm() and processComplete() and handles starting multi-step if appropriate.
2 string references to 'tfa_form_submit'
- TfaTestSend::getForm in tests/
includes/ tfa_test.send.inc - Get TFA process form from plugin.
- tfa_form in ./
tfa.form.inc - Main TFA process form builder.
File
- ./
tfa.form.inc, line 84 - Form-related functions.
Code
function tfa_form_submit($form, &$form_state) {
$account = $form['account']['#value'];
$tfa = tfa_get_process($account);
if (!$tfa
->submitForm($form, $form_state)) {
// If fallback was triggered TFA process has been reset to new validate
// plugin so run begin and store new context.
if (isset($form_state['values']['fallback']) && $form_state['values']['op'] === $form_state['values']['fallback']) {
$tfa
->begin();
}
$context = $tfa
->getContext();
tfa_set_context($account, $context);
$form_state['rebuild'] = TRUE;
}
else {
// TFA process is complete so finalize and authenticate user.
$context = tfa_get_context($account);
$tfa
->finalize();
tfa_login($account);
// Set redirect based on query parameters, existing $form_state or context.
$form_state['redirect'] = _tfa_form_get_destination($context, $form_state, $account);
}
}