You are here

private function LoginValidator::authenticationHelpText in Lightweight Directory Access Protocol (LDAP) 8.3

Get human readable authentication error string.

Parameters

int $error: Error code.

Return value

string Human readable error text.

3 calls to LoginValidator::authenticationHelpText()
LoginValidator::failureResponse in ldap_authentication/src/Controller/LoginValidator.php
Failure response.
LoginValidator::testCredentials in ldap_authentication/src/Controller/LoginValidator.php
Credentials are tested.
LoginValidator::testSsoCredentials in ldap_authentication/src/Controller/LoginValidator.php
Test the SSO credentials.

File

ldap_authentication/src/Controller/LoginValidator.php, line 569

Class

LoginValidator
Handles the actual testing of credentials and authentication of users.

Namespace

Drupal\ldap_authentication\Controller

Code

private function authenticationHelpText($error) {
  switch ($error) {
    case self::AUTHENTICATION_FAILURE_CONNECTION:
      $msg = $this
        ->t('Failed to connect to LDAP server');
      break;
    case self::AUTHENTICATION_FAILURE_BIND:
      $msg = $this
        ->t('Failed to bind to LDAP server');
      break;
    case self::AUTHENTICATION_FAILURE_DISALLOWED:
      $msg = $this
        ->t('User disallowed');
      break;
    case self::AUTHENTICATION_FAILURE_FIND:
    case self::AUTHENTICATION_FAILURE_CREDENTIALS:
    case self::AUTHENTICATION_FAILURE_GENERIC:
      $msg = $this
        ->t('Sorry, unrecognized username or password.');
      break;
    case self::AUTHENTICATION_FAILURE_SERVER:
      $msg = $this
        ->t('Authentication Server or Configuration Error.');
      break;
    case self::AUTHENTICATION_SUCCESS:
      $msg = $this
        ->t('Authentication successful');
      break;
    default:
      $msg = $this
        ->t('unknown error: @error', [
        '@error' => $error,
      ]);
      break;
  }
  return $msg;
}