diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2013-10-08 12:13:24 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2013-10-08 12:13:24 +0200 |
commit | 053b55721d69a54b8d9460868d9e6f3edc606271 (patch) | |
tree | 873135b3a47e0ef03abcfdbbcf251b66f37863fc /lib/base.php | |
parent | c3286402a846bf874ae78a61880442f8ebfd7ba9 (diff) | |
parent | 2123ef57d830abe24684b54f9819b75ab780834e (diff) | |
download | nextcloud-server-053b55721d69a54b8d9460868d9e6f3edc606271.tar.gz nextcloud-server-053b55721d69a54b8d9460868d9e6f3edc606271.zip |
Merge branch 'master' into fixing-appframework-master
Diffstat (limited to 'lib/base.php')
-rw-r--r-- | lib/base.php | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/lib/base.php b/lib/base.php index bf2c51f0ad3..7299a012da9 100644 --- a/lib/base.php +++ b/lib/base.php @@ -493,6 +493,11 @@ class OC { if (isset($_SERVER['PHP_AUTH_USER']) && self::$session->exists('user_id') && $_SERVER['PHP_AUTH_USER'] != self::$session->get('user_id')) { + $sessionUser = self::$session->get('user_id'); + $serverUser = $_SERVER['PHP_AUTH_USER']; + OC_Log::write('core', + "Session user-id ($sessionUser) doesn't match SERVER[PHP_AUTH_USER] ($serverUser).", + OC_Log::WARN); OC_User::logout(); } @@ -747,11 +752,17 @@ class OC { protected static function handleLogin() { OC_App::loadApps(array('prelogin')); $error = array(); + + // auth possible via apache module? + if (OC::tryApacheAuth()) { + $error[] = 'apacheauthfailed'; + } // remember was checked after last login - if (OC::tryRememberLogin()) { + elseif (OC::tryRememberLogin()) { $error[] = 'invalidcookie'; - // Someone wants to log in : - } elseif (OC::tryFormLogin()) { + } + // logon via web form + elseif (OC::tryFormLogin()) { $error[] = 'invalidpassword'; } @@ -769,6 +780,20 @@ class OC { } } + protected static function tryApacheAuth() { + $return = OC_User::handleApacheAuth(); + + // if return is true we are logged in -> redirect to the default page + if ($return === true) { + $_REQUEST['redirect_url'] = \OC_Request::requestUri(); + OC_Util::redirectToDefaultPage(); + exit; + } + + // in case $return is null apache based auth is not enabled + return is_null($return) ? false : true; + } + protected static function tryRememberLogin() { if (!isset($_COOKIE["oc_remember_login"]) || !isset($_COOKIE["oc_token"]) |