Updating session variables to add phpci_ prefix.

Fixes #652
This commit is contained in:
Dan Cryer 2014-12-01 15:56:33 +00:00
commit a92585fcb8
8 changed files with 29 additions and 26 deletions

View file

@ -42,7 +42,7 @@ class SessionController extends \PHPCI\Controller
$user = $this->userStore->getByEmail($this->getParam('email'));
if ($user && password_verify($this->getParam('password', ''), $user->getHash())) {
$_SESSION['user_id'] = $user->getId();
$_SESSION['phpci_user_id'] = $user->getId();
header('Location: ' . $this->getLoginRedirect());
die;
} else {
@ -84,7 +84,9 @@ class SessionController extends \PHPCI\Controller
*/
public function logout()
{
$_SESSION = array();
unset($_SESSION['phpci_user']);
unset($_SESSION['phpci_user_id']);
session_destroy();
header('Location: ' . PHPCI_URL);
die;
@ -147,8 +149,8 @@ MSG;
$hash = password_hash($this->getParam('password'), PASSWORD_DEFAULT);
$user->setHash($hash);
$_SESSION['user'] = $this->userStore->save($user);
$_SESSION['user_id'] = $user->getId();
$_SESSION['phpci_user'] = $this->userStore->save($user);
$_SESSION['phpci_user_id'] = $user->getId();
header('Location: ' . PHPCI_URL);
die;
@ -164,9 +166,9 @@ MSG;
{
$rtn = PHPCI_URL;
if (!empty($_SESSION['login_redirect'])) {
$rtn .= $_SESSION['login_redirect'];
$_SESSION['login_redirect'] = null;
if (!empty($_SESSION['phpci_login_redirect'])) {
$rtn .= $_SESSION['phpci_login_redirect'];
$_SESSION['phpci_login_redirect'] = null;
}
return $rtn;