You are here

public static function EmailTemplateService::checkForEmailTemplate in Lightweight Directory Access Protocol (LDAP) 8.3

Same name and namespace in other branches
  1. 8.4 ldap_authentication/src/Routing/EmailTemplateService.php \Drupal\ldap_authentication\Routing\EmailTemplateService::checkForEmailTemplate()

Form submit callback to check for an email template and redirect if needed.

1 call to EmailTemplateService::checkForEmailTemplate()
EmailTemplateService::checkTemplate in ldap_authentication/src/Routing/EmailTemplateService.php
Check for template if enabled.

File

ldap_authentication/src/Routing/EmailTemplateService.php, line 45

Class

EmailTemplateService
Class EmailTemplateService.

Namespace

Drupal\ldap_authentication\Routing

Code

public static function checkForEmailTemplate() {
  if (self::profileNeedsUpdate()) {
    $url = Url::fromRoute('ldap_authentication.profile_update_form');

    // Not injected since we need to have this callback be static.
    $currentRoute = \Drupal::service('path.current')
      ->getPath();
    if ($currentRoute != '/user/ldap-profile-update' && $currentRoute != '/user/logout') {
      $response = new RedirectResponse($url
        ->toString());
      $response
        ->send();
    }
  }
}