From 15a900982881430624eadd068cd2c47a50c07bd8 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Fri, 17 Aug 2018 16:56:05 +0200 Subject: [PATCH] app/library/Auth.php: switch $_session_key to a constant. --- app/library/Auth.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/app/library/Auth.php b/app/library/Auth.php index 33730ab..ade7a70 100644 --- a/app/library/Auth.php +++ b/app/library/Auth.php @@ -9,10 +9,7 @@ use App\Model\Data\User, class Auth extends Component { - /** - * @var string - */ - protected $_session_key = 'auth'; + const SESSION_KEY = 'auth'; /** * Login using email/user + password combination. @@ -92,7 +89,7 @@ class Auth extends Component */ public function setIdentity($identity) { - $this->session->set($this->_session_key, $identity); + $this->session->set(self::SESSION_KEY, $identity); return $this; } @@ -101,7 +98,7 @@ class Auth extends Component */ public function getIdentity() { - $id = $this->session->get($this->_session_key); + $id = $this->session->get(self::SESSION_KEY); if ($id !== null) { return User::findFirst($id); @@ -116,7 +113,7 @@ class Auth extends Component { if ($this->hasIdentity()) { - $id = $this->session->get($this->_session_key); + $id = $this->session->get(self::SESSION_KEY); return User::findFirst($id); } @@ -128,8 +125,6 @@ class Auth extends Component return $this->getIdentity() !== NULL; } - - /** * Clears the identity information. * @@ -137,7 +132,7 @@ class Auth extends Component */ public function clearIdentity() { - $this->session->remove($this->_session_key); + $this->session->remove(self::SESSION_KEY); return $this; } }