diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php index 0c6d502cea00..2bbc29d33e9c 100644 --- a/lib/private/User/Session.php +++ b/lib/private/User/Session.php @@ -86,7 +86,7 @@ class Session implements IUserSession, Emitter { private $session; /** @var ITimeFactory */ - private $timeFacory; + private $timeFactory; /** @var IProvider */ private $tokenProvider; @@ -100,14 +100,14 @@ class Session implements IUserSession, Emitter { /** * @param IUserManager $manager * @param ISession $session - * @param ITimeFactory $timeFacory + * @param ITimeFactory $timeFactory * @param IProvider $tokenProvider * @param IConfig $config */ - public function __construct(IUserManager $manager, ISession $session, ITimeFactory $timeFacory, $tokenProvider, IConfig $config) { + public function __construct(IUserManager $manager, ISession $session, ITimeFactory $timeFactory, $tokenProvider, IConfig $config) { $this->manager = $manager; $this->session = $session; - $this->timeFacory = $timeFacory; + $this->timeFactory = $timeFactory; $this->tokenProvider = $tokenProvider; $this->config = $config; } @@ -345,7 +345,7 @@ protected function supportsCookies(IRequest $request) { if (!is_null($request->getCookie('cookie_test'))) { return true; } - setcookie('cookie_test', 'test', $this->timeFacory->getTime() + 3600); + setcookie('cookie_test', 'test', $this->timeFactory->getTime() + 3600); return false; } @@ -603,10 +603,13 @@ private function getPassword($password) { */ private function checkTokenCredentials(IToken $dbToken, $token) { // Check whether login credentials are still valid and the user was not disabled - // This check is performed each 5 minutes + // This check is performed each 5 minutes per default + // However, we try to read last_check_timeout from the appconfig table so the + // administrator could change this 5 minutes timeout $lastCheck = $dbToken->getLastCheck() ? : 0; - $now = $this->timeFacory->getTime(); - if ($lastCheck > ($now - 60 * 5)) { + $now = $this->timeFactory->getTime(); + $last_check_timeout = intval($this->config->getAppValue('core', 'last_check_timeout', 5)); + if ($lastCheck > ($now - 60 * $last_check_timeout)) { // Checked performed recently, nothing to do now return true; }