Skip to content
This repository was archived by the owner on Nov 28, 2018. It is now read-only.
Open
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions src/Strong/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function logout($destroy = false) {
session_destroy();
} else {
// Remove the user object from the session
$_SESSION['auth_user'] = array();
$_SESSION[$this->config['session_key']] = array();
}

// Double check
Expand All @@ -80,8 +80,8 @@ public function logout($destroy = false) {
* @return array|null
*/
public function getUser() {
if(isset($_SESSION['auth_user']) && !empty($_SESSION['auth_user'])){
return $_SESSION['auth_user'];
if(isset($_SESSION[$this->config['session_key']]) && !empty($_SESSION[$this->config['session_key']])){
return $_SESSION[$this->config['session_key']];
}
return null;
}
Expand All @@ -94,7 +94,7 @@ public function getUser() {
*/
protected function completeLogin($user) {
// Store session data
$_SESSION['auth_user'] = $user;
$_SESSION[$this->config['session_key']] = $user;
return true;
}
}
2 changes: 1 addition & 1 deletion src/Strong/Provider/Activerecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Activerecord extends \Strong\Provider
* @return boolean
*/
public function loggedIn() {
return (isset($_SESSION['auth_user']) && !empty($_SESSION['auth_user']));
return (isset($_SESSION[$this->config['session_key']]) && !empty($_SESSION[$this->config['session_key']]));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Strong/Provider/Hashtable.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function __construct($config)
}

public function loggedIn() {
return (isset($_SESSION['auth_user']) && !empty($_SESSION['auth_user']));
return (isset($_SESSION[$this->config['session_key']]) && !empty($_SESSION[$this->config['session_key']]));
}

public function login($username, $password) {
Expand Down
2 changes: 1 addition & 1 deletion src/Strong/Provider/PDO.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function __construct($config)
*/
public function loggedIn()
{
return (isset($_SESSION['auth_user']) && !empty($_SESSION['auth_user']));
return (isset($_SESSION[$this->config['session_key']]) && !empty($_SESSION[$this->config['session_key']]));
}

/**
Expand Down
3 changes: 3 additions & 0 deletions src/Strong/Strong.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ public function getName()
public function setConfig($config = array())
{
$this->config = array_merge($this->config, $config);
if(empty($this->config['session_key'])) {
$this->config['session_key'] = 'auth_user_'.$this->config['name'];
}
return $this;
}

Expand Down