You are here

function _bakery_login_redirect in Bakery Single Sign-On System 8.2

Same name and namespace in other branches
  1. 7.2 bakery.module \_bakery_login_redirect()
1 string reference to '_bakery_login_redirect'
bakery_form_alter in ./bakery.module
Implements hook_form_alter().

File

./bakery.module, line 173
For implementing different hooks for bakery SSO functionality.

Code

function _bakery_login_redirect($form, FormStateInterface $form_state) {
  $dest = \Drupal::service('bakery.redirect')
    ->get();
  if ($dest) {
    $response = new TrustedRedirectResponse($dest);

    // Ensure check_logged_in logic doesn't break our redirect.
    \Drupal::request()
      ->getSession()
      ->remove('check_logged_in');
    $form_state
      ->setResponse($response);
  }
}