function security_questions_settings_form in Security Questions 6
Same name and namespace in other branches
- 6.2 security_questions.admin.inc \security_questions_settings_form()
- 7.2 security_questions.admin.inc \security_questions_settings_form()
- 7 security_questions.module \security_questions_settings_form()
Security Questions settings form.
1 string reference to 'security_questions_settings_form'
- security_questions_menu in ./
security_questions.module - Implements hook_menu().
File
- ./
security_questions.module, line 87 - Main module file for security_questions.
Code
function security_questions_settings_form(&$form_state) {
// Create a form to ask the admin how many questions the user
// should have answered.
$form = array();
$form['security_questions_number_required'] = array(
'#type' => 'textfield',
'#title' => t('Number of questions'),
'#description' => t('Number of questions users are required to have answered.'),
'#default_value' => variable_get('security_questions_number_required', 3),
'#required' => TRUE,
);
$form['security_questions_user_questions'] = array(
'#type' => 'checkbox',
'#title' => t('Enable user defined questions.'),
'#description' => t('If this is enabled, users will be able to enter their own questions to answer.'),
'#default_value' => variable_get('security_questions_user_questions', FALSE),
'#required' => FALSE,
);
$form['security_questions_password_reset'] = array(
'#type' => 'checkbox',
'#title' => t('Enable question challenge on password reset request.'),
'#description' => t('If this is enabled, users will be forced to answer a question during the password reset process.'),
'#default_value' => variable_get('security_questions_password_reset', FALSE),
'#required' => FALSE,
);
$form['security_questions_user_login'] = array(
'#type' => 'checkbox',
'#title' => t('Enable question challenge on user login.'),
'#description' => t('If this is enabled, users will be forced to answer a question when they login.'),
'#default_value' => variable_get('security_questions_user_login', TRUE),
'#required' => FALSE,
);
$form['security_questions_protection_mode'] = array(
'#type' => 'select',
'#title' => t('Protection Mode'),
'#description' => t("Should questions be asked before or after asking for a user's password. If questions are asked before the password, bad people may be able to guess a user's answers through social engineering, just by knowing the user's username."),
'#options' => array(
'before' => t('Before'),
'after' => t('After'),
),
'#default_value' => variable_get('security_questions_protection_mode', 'before'),
'#required' => FALSE,
);
$form['security_questions_cookie'] = array(
'#type' => 'checkbox',
'#title' => t('Enable "remember this computer" cookies'),
'#description' => t('If this is enabled, users will not be asked to answer questions everytime they log in.'),
'#default_value' => variable_get('security_questions_cookie', FALSE),
'#required' => FALSE,
);
$form['security_questions_cookie_expire'] = array(
'#type' => 'textfield',
'#title' => t('How long should users not be asked questions'),
'#required' => FALSE,
'#description' => t('This setting only has effect if the above cookie setting is enabled. This should be a string that can be read by !url such as + 10 days or + 2 weeks', array(
'!url' => l(t('php\'s strtotime()'), "http://php.net/manual/en/function.strtotime.php"),
)),
'#default_value' => variable_get('security_questions_cookie_expire', '+1 week'),
);
return system_settings_form($form);
}