diff --git a/~dev_rating/application/classes/Controller/Handler/Session.php b/~dev_rating/application/classes/Controller/Handler/Session.php index 1b4f7dce9a68fbcbb0b6c85b4d4096d02fda54df..6cf985196899fb80d67e12d024bba49c8987fe4d 100644 --- a/~dev_rating/application/classes/Controller/Handler/Session.php +++ b/~dev_rating/application/classes/Controller/Handler/Session.php @@ -1,23 +1,23 @@ <?php defined('SYSPATH') or die('No direct script access.'); class Controller_Handler_Session extends Controller_Handler { + + protected $_session; public function before() { - $this->setAccessLevel(self::ACCESS_USER); + $this->setAccessLevel(self::ACCESS_ANYBODY); parent::before(); + $this->_session = Session::instance(); } public function action_getSessionTime() { - $session = Session::instance(); - if ($session->get('LoggedIn')) { - $dif_time = $session->get('dif_time'); + + if (User::instance()->isSignedIn() && $this->_session) { + $dif_time = $this->_session->get('dif_time'); $timeout = User::SESSION_LIFETIME; $remain = $timeout - $dif_time; - if ($remain <= 0) { - $this->completeSignOut(); - } - $session->set('last_time', - $session->get('last_time') - $dif_time); + $this->_session->set('last_time', + $this->_session->get('last_time') - $dif_time); } else { $remain = 0; } @@ -25,8 +25,8 @@ class Controller_Handler_Session extends Controller_Handler { } public function action_closeSession() { - if ($session->get('LoggedIn')) { - $this->completeSignOut(); + if (User::instance()->isSignedIn()) { + User::instance()->completeSignOut(); } $this->response->body(json_encode(0)); } diff --git a/~dev_rating/modules/account/classes/Kohana/User.php b/~dev_rating/modules/account/classes/Kohana/User.php index 5f36cbcf347b5d43ec9faa4a5b50dd8319f412e6..8dc9b9d5fb670505172d6549363a6a0a98dd931c 100644 --- a/~dev_rating/modules/account/classes/Kohana/User.php +++ b/~dev_rating/modules/account/classes/Kohana/User.php @@ -8,7 +8,7 @@ class Kohana_User implements ArrayAccess { protected $_model; protected $_userInfo; - const SESSION_LIFETIME = 600; //seconds + const SESSION_LIFETIME = 20; //seconds /** * Вовзращает экземпляр класса (singleton-паттерн)