function _tfa_basic_set_next_step in TFA Basic plugins 7
Set form rebuild, next step, and message if any plugin steps left.
1 call to _tfa_basic_set_next_step()
- tfa_basic_setup_form_submit in ./
tfa_basic.pages.inc - Setup form submit.
File
- ./
tfa_basic.pages.inc, line 696
Code
function _tfa_basic_set_next_step(&$form_state, $this_step, $skipped_step = FALSE) {
// Remove this step from steps left.
$form_state['storage']['steps_left'] = array_diff($form_state['storage']['steps_left'], array(
$this_step,
));
if (!empty($form_state['storage']['steps_left'])) {
// Contextual reporting.
$output = FALSE;
switch ($this_step) {
case 'tfa_basic_totp':
$output = $skipped_step ? t('Application codes not enabled.') : t('Application code verified.');
break;
case 'tfa_basic_sms':
$output = $skipped_step ? t('SMS code delivery not enabled.') : t('SMS code verified.');
break;
case 'tfa_basic_trusted_browser':
// Handle whether the checkbox was unchecked.
if ($skipped_step || empty($form_state['values']['trust'])) {
$output = t('Browser not saved.');
}
else {
$output = t('Browser saved.');
}
break;
case 'tfa_basic_recovery_code':
$output = $skipped_step ? t('Recovery codes not saved.') : t('Saved recovery codes.');
break;
}
$count = count($form_state['storage']['steps_left']);
$output .= ' ' . format_plural($count, 'One setup step remaining.', '@count TFA setup steps remain.', array(
'@count' => $count,
));
if ($output) {
drupal_set_message($output);
}
// Set next step and mark form for rebuild.
$next_step = array_shift($form_state['storage']['steps_left']);
$form_state['storage']['step_method'] = $next_step;
$form_state['rebuild'] = TRUE;
}
}