You are here

function ldap_sso_user_logout in LDAP Single Sign On 8

Same name and namespace in other branches
  1. 8.4 ldap_sso.module \ldap_sso_user_logout()
  2. 7.2 ldap_sso.module \ldap_sso_user_logout()
  3. 7 ldap_sso.module \ldap_sso_user_logout()

Implements hook_user_logout().

File

./ldap_sso.module, line 15
This module injects itself into Drupal's Authentication stack.

Code

function ldap_sso_user_logout($account) {
  if (\Drupal::config('ldap_sso.settings')
    ->get('seamlessLogin') == 1) {
    if (\Drupal::config('ldap_sso.settings')
      ->get('cookieExpire')) {
      setcookie('sso_stop', 'true', REQUEST_TIME - 3600, base_path(), '');
    }
    else {
      setcookie('sso_stop', 'true', 0, base_path(), '');
    }
  }
  if (\Drupal::config('ldap_sso.settings')
    ->get('redirectOnLogout')) {
    $redirect_url = \Drupal::config('ldap_sso.settings')
      ->get('logoutRedirectPath');
    $redirect = new RedirectResponse(Url::fromUserInput($redirect_url)
      ->toString());
    $redirect
      ->send();
  }
}