summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-01-09 03:32:17 -0800
committerThomas Müller <thomas.mueller@tmit.eu>2014-01-09 03:32:17 -0800
commite0dbc1b67e00703ff90e643fb70f4e9e631825be (patch)
treeefed9bb7e9a246a8807f3e8bdec4248be34fb9e4 /lib
parentd8b8abb429d3d66598a16d25cf55f7dc19e3f996 (diff)
parentc3829dfa61ce9d884f8c7d9c81381ac5987e8250 (diff)
downloadnextcloud-server-e0dbc1b67e00703ff90e643fb70f4e9e631825be.tar.gz
nextcloud-server-e0dbc1b67e00703ff90e643fb70f4e9e631825be.zip
Merge pull request #6693 from owncloud/fixing-apache-login
Fixing apache login
Diffstat (limited to 'lib')
-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();
}