Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions lib/private/User/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class Session implements IUserSession, Emitter {
private $session;

/** @var ITimeFactory */
private $timeFacory;
private $timeFactory;

/** @var IProvider */
private $tokenProvider;
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand Down