You are here

function password_strength_admin_settings in Password Strength 5

Same name and namespace in other branches
  1. 6 password_strength.module \password_strength_admin_settings()

Menu callback

1 string reference to 'password_strength_admin_settings'
password_strength_menu in ./password_strength.module
Implementation of hook_menu().

File

./password_strength.module, line 56

Code

function password_strength_admin_settings() {
  $form['rules'] = array(
    '#type' => 'fieldset',
    '#title' => t('Enforcement rules'),
  );
  $form['rules']['password_strength_verify_on_server'] = array(
    '#type' => 'checkbox',
    '#title' => t('Verify password strength on server'),
    '#default_value' => variable_get('password_strength_verify_on_server', 0),
    '#description' => t('Drupal should verify and enforce password strength on the server (i.e. not only in JavaScript).'),
  );
  $form['rules']['password_strength_not_username'] = array(
    '#type' => 'checkbox',
    '#title' => t('Test password not same as username'),
    '#default_value' => variable_get('password_strength_not_username', 1),
  );
  $options = drupal_map_assoc(array(
    3,
    4,
    5,
    6,
    7,
    8,
    9,
    10,
    11,
    12,
    13,
    14,
    15,
    16,
  ));
  $form['rules']['password_strength_min_length'] = array(
    '#type' => 'select',
    '#title' => t('Minimum length'),
    '#options' => $options,
    '#default_value' => variable_get('password_strength_min_length', 6),
  );
  $form['rules']['password_strength_min_level'] = array(
    '#type' => 'select',
    '#title' => t('Enforcement level'),
    '#options' => array(
      1 => t('None'),
      2 => t('Low'),
      3 => t('Medium'),
      4 => t('High'),
    ),
    '#default_value' => variable_get('password_strength_min_level', 4),
    '#description' => t('
      <ul>
        <li><em>None:</em> 1 or fewer rules passed.</li>
        <li><em>Low:</em> 2 rules passed.</li>
        <li><em>Medium:</em> 3 rules passed.</li>
        <li><em>High:</em> 4 rules passed.</li>
      </ul>
    '),
  );
  return system_settings_form($form);
}