You are here

function restrict_by_ip_login_settings in Restrict Login or Role Access by IP Address 7.3

Same name and namespace in other branches
  1. 6.3 restrict_by_ip.module \restrict_by_ip_login_settings()

Menu callback for restrict login settings

1 string reference to 'restrict_by_ip_login_settings'
restrict_by_ip_menu in ./restrict_by_ip.module
Implementation of hook_menu().

File

./restrict_by_ip.module, line 203
Allows the admin to select which ip addresses role or a user can login from for this site Some of the code below is taken from the cck_ipaddress_module

Code

function restrict_by_ip_login_settings() {
  drupal_set_title(t('Restrict login by IP'));
  $form = array();
  $form['current_ip'] = array(
    '#markup' => t('Your current IP address is %ipaddress. If this is wrong, make sure you have the correct header configured in general settings.', array(
      '%ipaddress' => _restrict_by_ip_get_ip(),
    )),
    '#prefix' => '<p>',
    '#suffix' => '</p>',
  );
  $form['restrict_by_ip_error_page'] = array(
    '#type' => 'textfield',
    '#title' => t('Login denied error page'),
    '#description' => t("This the address of the page to which the user will be redirected if they are not allowed to login. If you don't set this the user will not know why they couldn't login"),
    '#default_value' => variable_get('restrict_by_ip_error_page', ''),
  );
  $form['restrict_by_ip_login_range'] = array(
    '#type' => 'textfield',
    '#title' => t('Restrict global login to allowed IP range'),
    '#maxlength' => NULL,
    '#description' => t('To restrict login for ALL users, enter global IP Address Ranges in CIDR Notation separated with semi-colons, with no trailing semi-colon. E.G. 10.20.30.0/24;192.168.199.1/32;1.0.0.0/8<br />For more information on CIDR notation click <a href="http://www.brassy.net/2007/mar/cidr_basic_subnetting">here</a>.<br />Leave field blank to disable IP restrictions for user login.'),
    '#default_value' => variable_get('restrict_by_ip_login_range', ''),
  );
  $form['restrict_login_by_ip_list'] = array(
    '#type' => 'fieldset',
    '#title' => t('Current login restrictions'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['restrict_login_by_ip_list']['list'] = array(
    '#markup' => theme('restrict_by_ip_login_list'),
  );
  return system_settings_form($form);
}