You are here

function disable_login_settings_form in Disable Login Page 7

Disable login admin settings form.

1 string reference to 'disable_login_settings_form'
disable_login_menu in ./disable_login.module
Implements hook_menu().

File

./disable_login.module, line 59
Disable Login module, for protecting login page from anonymous users.

Code

function disable_login_settings_form($form, &$form_state) {
  $form = array();
  $form['disable_login'] = [
    '#type' => 'checkbox',
    '#title' => 'Disable public access to login page without secret key',
    '#description' => t('Use this to turn on/off protection on the login page'),
    '#default_value' => variable_get('disable_login', '1'),
  ];
  $form['disable_login_querystring'] = [
    '#type' => 'textfield',
    '#title' => 'Querystring name',
    '#maxlength' => 255,
    '#size' => 128,
    '#description' => t('The name of the querystring to look for the secret key'),
    '#default_value' => variable_get('disable_login_querystring', 'key'),
  ];
  $form['disable_login_secret'] = [
    '#type' => 'textfield',
    '#title' => 'Secret key',
    '#maxlength' => 255,
    '#size' => 128,
    '#description' => t('The value of the secret key to access the login page'),
    '#default_value' => variable_get('disable_login_secret', ''),
  ];
  $form['#submit'][] = 'disable_login_settings_form_submit';
  return system_settings_form($form);
}