You are here

function simple_ldap_user_form_simple_ldap_user_admin_alter in Simple LDAP 7.2

Add a fall-back option when authenticating against LDAP.

File

simple_ldap_user/simple_ldap_user.password.inc, line 354
Secure password hashing functions for user authentication.

Code

function simple_ldap_user_form_simple_ldap_user_admin_alter(&$form, &$form_state, $form_id) {
  $form['advanced']['simple_ldap_user_auth_fallback'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Fallback Authentication'),
    '#options' => array(
      'nopass' => t('fallback to Drupal if LDAP password is empty'),
      'norecord' => t('fallback to Drupal if no LDAP record exists'),
    ),
    '#description' => t('Simple LDAP can fallback to using the password saved in the Drupal database.  Select when (if ever) this should be done.  Requires a password attribute to be selected above.'),
    '#default_value' => simple_ldap_user_variable_get('simple_ldap_user_auth_fallback'),
  );
  $form['advanced']['simple_ldap_user_auth_fallback_writeback'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Writeback on Fallback'),
    '#options' => array(
      'nopass' => t('Writeback the user\'s password when their LDAP password is empty.'),
      'norecord' => t('Writeback full LDAP record when the user\'s LDAP record does not exist.'),
    ),
    '#description' => t('When using Fallback Authentication, should LDAP be updated on successful authentication?  Requires write-access to the LDAP server and a user password field to be selected above.'),
    '#default_value' => simple_ldap_user_variable_get('simple_ldap_user_auth_fallback_writeback'),
  );
}