You are here

function ldap_authentication_form_user_pass_alter in Lightweight Directory Access Protocol (LDAP) 7.2

Same name and namespace in other branches
  1. 8.4 ldap_authentication/ldap_authentication.module \ldap_authentication_form_user_pass_alter()
  2. 8.2 ldap_authentication/ldap_authentication.module \ldap_authentication_form_user_pass_alter()
  3. 8.3 ldap_authentication/ldap_authentication.module \ldap_authentication_form_user_pass_alter()
  4. 7 ldap_authentication/ldap_authentication.module \ldap_authentication_form_user_pass_alter()

Implements hook_form_FORM_ID_alter().

File

ldap_authentication/ldap_authentication.module, line 363
This module injects itself into Drupal's Authentication stack.

Code

function ldap_authentication_form_user_pass_alter(&$form, $form_state) {

  // The following could be in a theme preproces function.
  $auth_conf = ldap_authentication_get_valid_conf();
  $form['ldap_warning'] = [
    '#type' => 'item',
    '#markup' => theme('ldap_authentication_user_pass_message', [
      'auth_conf' => $auth_conf,
    ]),
    '#weight' => 10,
  ];

  // Need to insert before user_pass_validate.
  array_unshift($form['#validate'], 'ldap_authentication_user_pass_validate');
}