You are here

function _auto_login_url_settings in Auto Login URL 7

Settings form for Auto Login URL.

Return value

object Form object.

1 string reference to '_auto_login_url_settings'
auto_login_url_menu in ./auto_login_url.module
Implements hook_menu().

File

./auto_login_url.module, line 229
Main file for auto_login_url module.

Code

function _auto_login_url_settings() {
  $form = array();

  // Secret word.
  $form['auto_login_url_secret'] = array(
    '#type' => 'textfield',
    '#title' => t('Secret word'),
    '#required' => TRUE,
    '#default_value' => _auto_login_url_get_secret(),
    '#description' => t('Secret word to create hashes that are stored in DB.
      Every time this changes all previous URLs are invalidated.'),
  );

  // Expiration.
  $form['auto_login_url_expiration'] = array(
    '#type' => 'textfield',
    '#title' => t('Expiration'),
    '#required' => TRUE,
    '#default_value' => variable_get('auto_login_url_expiration', 2592000),
    '#description' => t('Expiration of URLs in seconds.'),
    '#element_validate' => array(
      'element_validate_integer_positive',
    ),
  );

  // Short URL.
  $form['auto_login_url_short_url'] = array(
    '#type' => 'textfield',
    '#title' => t('Short URL'),
    '#required' => TRUE,
    '#default_value' => variable_get('auto_login_url_short_url', 'autologinurl'),
    '#description' => t('Set URL prefix to use before random token.'),
  );

  // Token length.
  $form['auto_login_url_token_length'] = array(
    '#type' => 'textfield',
    '#title' => t('Token length'),
    '#required' => TRUE,
    '#default_value' => variable_get('auto_login_url_token_length', 64),
    '#description' => t('Length of generated URL token.
      WARNING: Please understand the security implications of a short auto-login-url string before you change this value.
      It has to be between 8 and 64 digits.'),
    '#element_validate' => array(
      'element_validate_integer_positive',
    ),
  );

  // Delete URLs on use.
  $form['auto_login_url_delete_on_use'] = array(
    '#type' => 'checkbox',
    '#title' => t('Delete on use'),
    '#default_value' => variable_get('auto_login_url_delete_on_use', FALSE),
    '#description' => t('Auto delete URLs after use.'),
  );
  $form = system_settings_form($form);
  $form['#submit'][] = '_auto_login_url_settings_submit';
  return $form;
}