You are here

function ldap_authentication_user_pass_validate in Lightweight Directory Access Protocol (LDAP) 7

Same name and namespace in other branches
  1. 8.4 ldap_authentication/ldap_authentication.module \ldap_authentication_user_pass_validate()
  2. 8.2 ldap_authentication/ldap_authentication.module \ldap_authentication_user_pass_validate()
  3. 8.3 ldap_authentication/ldap_authentication.module \ldap_authentication_user_pass_validate()
  4. 7.2 ldap_authentication/ldap_authentication.module \ldap_authentication_user_pass_validate()
1 string reference to 'ldap_authentication_user_pass_validate'
ldap_authentication_form_user_pass_alter in ldap_authentication/ldap_authentication.module
Implements hook_form_FORM_ID_alter().

File

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

Code

function ldap_authentication_user_pass_validate(&$form_state) {
  $name_or_mail = trim($form_state['name']['#value']);
  if ($account = user_load_by_mail($name_or_mail)) {
  }
  else {
    $account = user_load_by_name($name_or_mail);
  }
  if (ldap_authentication_ldap_authenticated($account)) {
    $vars = array(
      'account' => $account,
      'auth_conf' => ldap_authentication_get_valid_conf(),
    );
    form_set_error('name', theme('ldap_authentication_user_pass_validate_ldap_authenticated', $vars));
  }
}