/** * Returns and initializes $this->sessionSection. * @return Nette\Http\SessionSection */ protected function getSessionSection($need) { $ret = parent::getSessionSection($need); if (!is_null($ret)) { if ($ret->authenticated && $ret->identity->browser !== $this->browser->getName() && $ret->identity->browserVersion !== $this->browser->getVersion()) { $ret->authenticated = FALSE; $this->sessionHandler->regenerateId(); $ret->reason = static::MANUAL; $ret->authTime = NULL; } } return $ret; }
/** * Sets the authenticated status of this user. * @param bool * @return self */ public function setAuthenticated($state) { $section = $this->getSessionSection(TRUE); $section->authenticated = (bool) $state; // Session Fixation defence $this->sessionHandler->regenerateId(); if ($state) { $section->reason = NULL; $section->authTime = time(); // informative value } else { $section->reason = self::MANUAL; $section->authTime = NULL; } return $this; }