summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/base.php4
-rw-r--r--lib/private/user.php2
-rw-r--r--lib/private/user/session.php14
3 files changed, 11 insertions, 9 deletions
diff --git a/lib/base.php b/lib/base.php
index a8e9e901847..f30575c7b12 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -544,12 +544,12 @@ class OC {
OC_User::useBackend(new OC_User_Database());
OC_Group::useBackend(new OC_Group_Database());
- if (isset($_SERVER['PHP_AUTH_USER']) && self::$session->exists('user_id')
+ if (isset($_SERVER['PHP_AUTH_USER']) && self::$session->exists('loginname')
&& $_SERVER['PHP_AUTH_USER'] !== self::$session->get('loginname')) {
$sessionUser = self::$session->get('loginname');
$serverUser = $_SERVER['PHP_AUTH_USER'];
OC_Log::write('core',
- "Session user-id ($sessionUser) doesn't match SERVER[PHP_AUTH_USER] ($serverUser).",
+ "Session loginname ($sessionUser) doesn't match SERVER[PHP_AUTH_USER] ($serverUser).",
OC_Log::WARN);
OC_User::logout();
}
diff --git a/lib/private/user.php b/lib/private/user.php
index e0d6b9f3f51..98ebebbe5c1 100644
--- a/lib/private/user.php
+++ b/lib/private/user.php
@@ -246,6 +246,8 @@ class OC_User {
session_regenerate_id(true);
self::setUserId($uid);
self::setDisplayName($uid);
+ self::getUserSession()->setLoginName($uid);
+
OC_Hook::emit( "OC_User", "post_login", array( "uid" => $uid, 'password'=>'' ));
return true;
}
diff --git a/lib/private/user/session.php b/lib/private/user/session.php
index c2885d00413..1e299416fb3 100644
--- a/lib/private/user/session.php
+++ b/lib/private/user/session.php
@@ -115,13 +115,13 @@ class Session implements Emitter, \OCP\IUserSession {
/**
* set the login name
*
- * @param string login name for the logged in user
+ * @param string $loginName for the logged in user
*/
- public function setLoginname($loginname) {
- if (is_null($loginname)) {
+ public function setLoginName($loginName) {
+ if (is_null($loginName)) {
$this->session->remove('loginname');
} else {
- $this->session->set('loginname', $loginname);
+ $this->session->set('loginname', $loginName);
}
}
@@ -130,7 +130,7 @@ class Session implements Emitter, \OCP\IUserSession {
*
* @return string
*/
- public function getLoginname() {
+ public function getLoginName() {
if ($this->activeUser) {
return $this->session->get('loginname');
} else {
@@ -158,7 +158,7 @@ class Session implements Emitter, \OCP\IUserSession {
if (!is_null($user)) {
if ($user->isEnabled()) {
$this->setUser($user);
- $this->setLoginname($uid);
+ $this->setLoginName($uid);
$this->manager->emit('\OC\User', 'postLogin', array($user, $password));
return true;
} else {
@@ -176,7 +176,7 @@ class Session implements Emitter, \OCP\IUserSession {
public function logout() {
$this->manager->emit('\OC\User', 'logout');
$this->setUser(null);
- $this->setLoginname(null);
+ $this->setLoginName(null);
$this->unsetMagicInCookie();
}