You are here

protected function LoginValidatorBase::authenticationHelpText in Lightweight Directory Access Protocol (LDAP) 8.4

Get human readable authentication error string.

Parameters

int $error: Error code.

Return value

\Drupal\Core\StringTranslation\TranslatableMarkup Human readable error text.

3 calls to LoginValidatorBase::authenticationHelpText()
LoginValidatorBase::failureResponse in ldap_authentication/src/Controller/LoginValidatorBase.php
Failure response.
LoginValidatorLoginForm::testCredentials in ldap_authentication/src/Controller/LoginValidatorLoginForm.php
Credentials are tested.
LoginValidatorSso::testCredentials in ldap_authentication/src/Controller/LoginValidatorSso.php
@todo Reduce code duplication w/ LoginValidator, split this function up.

File

ldap_authentication/src/Controller/LoginValidatorBase.php, line 470

Class

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

Namespace

Drupal\ldap_authentication\Controller

Code

protected function authenticationHelpText(int $error) : TranslatableMarkup {
  switch ($error) {
    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:
      $msg = $this
        ->t('Sorry, unrecognized username or password.');
      break;
    case self::AUTHENTICATION_SUCCESS:
      $msg = $this
        ->t('Authentication successful');
      break;
    default:
      $msg = $this
        ->t('unknown error: @error', [
        '@error' => $error,
      ]);
      break;
  }
  return $msg;
}