You are here

function _ldap_authentication_err_text in Lightweight Directory Access Protocol (LDAP) 7.2

Same name and namespace in other branches
  1. 8.2 ldap_authentication/ldap_authentication.inc \_ldap_authentication_err_text()
  2. 7 ldap_authentication/ldap_authentication.inc \_ldap_authentication_err_text()

Get human readable authentication error string.

Parameters

int $error: as LDAP_AUTHENTICATION_RESULT_* constant defined in ldap_authentication.module.

Return value

string human readable error text

2 calls to _ldap_authentication_err_text()
ldap_authentication_fail_response in ldap_authentication/ldap_authentication.inc
ldap_authentication_test_credentials in ldap_authentication/ldap_authentication.inc

File

ldap_authentication/ldap_authentication.inc, line 762
Ldap_authentication helper functions.

Code

function _ldap_authentication_err_text($error) {
  $msg = t('unknown error: ' . $error);
  switch ($error) {
    case LDAP_AUTHENTICATION_RESULT_FAIL_CONNECT:
      $msg = t('Failed to connect to ldap server');
      break;
    case LDAP_AUTHENTICATION_RESULT_FAIL_BIND:
      $msg = t('Failed to bind to ldap server');
      break;
    case LDAP_AUTHENTICATION_RESULT_FAIL_FIND:
      $msg = t('Sorry, unrecognized username or password.');
      break;
    case LDAP_AUTHENTICATION_RESULT_FAIL_DISALLOWED:
      $msg = t('User disallowed');
      break;
    case LDAP_AUTHENTICATION_RESULT_FAIL_CREDENTIALS:
      $msg = t('Sorry, unrecognized username or password.');
      break;
    case LDAP_AUTHENTICATION_RESULT_FAIL_GENERIC:
      $msg = t('Sorry, unrecognized username or password.');
      break;
    case LDAP_AUTHENTICATION_RESULT_FAIL_SERVER:
      $msg = t('Authentication Server or Configuration Error.');
      break;
  }
  return $msg;
}