function tfa_basic_disable_form in TFA Basic plugins 7
1 string reference to 'tfa_basic_disable_form'
- tfa_basic_menu in ./
tfa_basic.module - Implements hook_menu().
File
- ./
tfa_basic.pages.inc, line 219
Code
function tfa_basic_disable_form($form, &$form_state, $account) {
global $user;
$form_state['storage']['account'] = $account;
if ($account->uid != $user->uid && user_access('administer users')) {
$preamble_desc = t('Are you sure you want to disable TFA on account %name?', array(
'%name' => $account->name,
));
$notice_desc = t('TFA settings and data will be lost. %name can re-enable TFA again from their profile.', array(
'%name' => $account->name,
));
if (tfa_basic_tfa_required($account)) {
drupal_set_message(t("This account is required to have TFA enabled per the 'require TFA' permission on one of their roles. Disabling TFA will remove their ability to log back into the site. If you continue, consider also removing the role so they can authenticate and setup TFA again."), 'warning');
}
}
else {
$preamble_desc = t('Are you sure you want to disable your two-factor authentication setup?');
$notice_desc = t("Your settings and data will be lost. You can re-enable two-factor authentication again from your profile.");
if (tfa_basic_tfa_required($account)) {
drupal_set_message(t('Your account must have at least one two-factor authentication method enabled. Continuing will disable your ability to log back into this site.'), 'warning');
$notice_desc = t('Your settings and data will be lost and you will be unable to log back into the site. To regain access contact a site administrator.');
}
}
$form['preamble'] = array(
'#prefix' => '<p class="preamble">',
'#suffix' => '</p>',
'#markup' => $preamble_desc,
);
$form['notice'] = array(
'#prefix' => '<p class="preamble">',
'#suffix' => '</p>',
'#markup' => $notice_desc,
);
$form['account']['current_pass'] = array(
'#type' => 'password',
'#title' => t('Confirm your current password'),
'#description_display' => 'before',
'#size' => 25,
'#weight' => -5,
'#attributes' => array(
'autocomplete' => 'off',
),
'#required' => TRUE,
);
$form['account']['mail'] = array(
'#type' => 'value',
'#value' => $account->mail,
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Disable'),
);
$form['actions']['cancel'] = array(
'#type' => 'submit',
'#value' => t('Cancel'),
'#limit_validation_errors' => array(),
'#submit' => array(
'tfa_basic_disable_form_submit',
),
);
return $form;
}