From 34a51b1f0b1619fe8becaa31513c6280cad3653c Mon Sep 17 00:00:00 2001 From: PavelBegunkov <asml.Silence@gmail.com> Date: Tue, 9 Jun 2015 11:46:46 +0300 Subject: [PATCH] fix signin - absent personal data --- ~dev_rating/application/classes/Controller/Handler.php | 8 +++++--- .../application/classes/Controller/Handler/Sign.php | 7 ++++--- ~dev_rating/modules/account/classes/Kohana/User.php | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/~dev_rating/application/classes/Controller/Handler.php b/~dev_rating/application/classes/Controller/Handler.php index 7c488a2a3..4ac390cb2 100644 --- a/~dev_rating/application/classes/Controller/Handler.php +++ b/~dev_rating/application/classes/Controller/Handler.php @@ -20,7 +20,7 @@ class Controller_Handler extends Controller { public function before() { - $isDownload = Cookie::get('fD'); + // $isDownload = Cookie::get('fD'); // TODO: check - unused var $this->user = User::instance(); // Если у нас запрос идет не из AJAX // if(!$this->request->is_ajax() && !$isDownload) @@ -41,10 +41,12 @@ class Controller_Handler extends Controller { // Получаем имя маршрута $route = Route::name($this->request->route()); $route .= ':'.$this->request->controller(); - $userMark = (int)$this->user->RoleMark; - if ($userMark == 0) { + try { + $userMark = (int)$this->user->RoleMark; + } catch (Exception $e) { $userMark = (int)1; } + // Если запрос не прошел на проверку доступа if( !$this->checkAccessLevel() || !$this->checkBitmask($userMark, $route)) diff --git a/~dev_rating/application/classes/Controller/Handler/Sign.php b/~dev_rating/application/classes/Controller/Handler/Sign.php index ea05703be..e773673a5 100644 --- a/~dev_rating/application/classes/Controller/Handler/Sign.php +++ b/~dev_rating/application/classes/Controller/Handler/Sign.php @@ -10,7 +10,8 @@ class Controller_Handler_Sign extends Controller_Handler { public function action_in() { $this->post->rule('login', 'email')->rule('login', 'not_empty'); - $checklogin = true; $response['success'] = false; + $checkLogin = true; + $response['success'] = false; if(!$this->post->check()) { $this->post = Validation::factory($this->post->data()); @@ -18,10 +19,10 @@ class Controller_Handler_Sign extends Controller_Handler { if(!$this->post->check()) { // Данные не безопасны, даже не пытаемся авторизоваться - $checklogin = false; + $checkLogin = false; } } - if($checklogin) + if($checkLogin) { $response['success'] = User::instance() ->signIn($this->post['login'], diff --git a/~dev_rating/modules/account/classes/Kohana/User.php b/~dev_rating/modules/account/classes/Kohana/User.php index 823579b1b..0db3e6942 100644 --- a/~dev_rating/modules/account/classes/Kohana/User.php +++ b/~dev_rating/modules/account/classes/Kohana/User.php @@ -139,7 +139,7 @@ class Kohana_User implements ArrayAccess $this->_session->set('UserHash', $this->hash($userHash)); $this->_session->set('PasswordHash', $passwordHash); $this->_session->set('start_time', time()); - $this->_session->set("SemesterID", $semester); + $this->_session->set('SemesterID', $semester); return true; } -- GitLab