You are here

public function BakeryUserHooks::update in Bakery Single Sign-On System 8.2

File

src/BakeryUserHooks.php, line 105

Class

BakeryUserHooks

Namespace

Drupal\bakery

Code

public function update(UserInterface $account) {

  // We need to push changes.
  if ($this
    ->isMain() && isset($_SESSION['bakery'])) {
    $this->kitchen
      ->ship(new Stroopwafel($account
      ->id(), $_SESSION['bakery']));
    unset($_SESSION['bakery']);
    if ($this->currentUser
      ->id() === $account
      ->id()) {

      // Rebake SSO cookie so user stays authenticated.
      $this->kitchen
        ->reBakeChocolateChipCookie($account);
    }
  }
}