You are here

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

Replace user email address with template.

2 calls to LoginValidatorBase::replaceUserMailWithTemplate()
LoginValidatorBase::prepareEmailTemplateToken in ldap_authentication/src/Controller/LoginValidatorBase.php
Prepare the email template token.
LoginValidatorBase::provisionDrupalUser in ldap_authentication/src/Controller/LoginValidatorBase.php
Provision the Drupal user.

File

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

Class

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

Namespace

Drupal\ldap_authentication\Controller

Code

protected function replaceUserMailWithTemplate() : void {

  // Fallback template in case one was not specified.
  $template = '@username@localhost';
  if (!empty($this->config
    ->get('emailTemplate'))) {
    $template = $this->config
      ->get('emailTemplate');
  }
  $this->ldapEntry
    ->setAttribute($this->serverDrupalUser
    ->get('mail_attr'), [
    (string) new FormattableMarkup($template, $this->emailTemplateTokens),
  ]);
}