From e66f609a6448d0e691d95516732d6d92b8bbab48 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Sat, 25 May 2013 05:51:51 +0300 Subject: [PATCH 1/5] Hack base.php to make Basic Auth work --- lib/base.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/base.php b/lib/base.php index 724bd250a5c..8622d0f8bf1 100644 --- a/lib/base.php +++ b/lib/base.php @@ -571,6 +571,7 @@ class OC { self::checkUpgrade(); } + OC::tryBasicAuthLogin(); if (!self::$CLI) { try { if (!OC_Config::getValue('maintenance', false)) { @@ -779,7 +780,7 @@ class OC { //OC_Log::write('core',"Logged in with HTTP Authentication", OC_Log::DEBUG); OC_User::unsetMagicInCookie(); $_REQUEST['redirect_url'] = OC_Request::requestUri(); - OC_Util::redirectToDefaultPage(); + //OC_Util::redirectToDefaultPage(); } return true; } From 138c7f615bef9994629d4aa283ae7f037dc0f14d Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Fri, 31 May 2013 00:28:03 +0200 Subject: [PATCH 2/5] Clean up hack. --- 3rdparty | 2 +- lib/base.php | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) mode change 160000 => 120000 3rdparty diff --git a/3rdparty b/3rdparty deleted file mode 160000 index a13af72fbe8..00000000000 --- a/3rdparty +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a13af72fbe8983686fc47489a750e60319f68ac2 diff --git a/3rdparty b/3rdparty new file mode 120000 index 00000000000..ae24324a4bd --- /dev/null +++ b/3rdparty @@ -0,0 +1 @@ +/home/tol/owncloud/3rdparty/ \ No newline at end of file diff --git a/lib/base.php b/lib/base.php index 8622d0f8bf1..42d8fb3c8d9 100644 --- a/lib/base.php +++ b/lib/base.php @@ -572,6 +572,7 @@ class OC { } OC::tryBasicAuthLogin(); + if (!self::$CLI) { try { if (!OC_Config::getValue('maintenance', false)) { @@ -679,9 +680,8 @@ class OC { $error[] = 'invalidpassword'; // The user is already authenticated using Apaches AuthType Basic... very usable in combination with LDAP - } elseif (OC::tryBasicAuthLogin()) { - $error[] = 'invalidpassword'; } + OC_Util::displayLoginPage(array_unique($error)); } @@ -779,8 +779,6 @@ class OC { if (OC_User::login($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) { //OC_Log::write('core',"Logged in with HTTP Authentication", OC_Log::DEBUG); OC_User::unsetMagicInCookie(); - $_REQUEST['redirect_url'] = OC_Request::requestUri(); - //OC_Util::redirectToDefaultPage(); } return true; } From e21649ccfffc8f4c02b62126d8b49d45ba280656 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Fri, 31 May 2013 00:53:15 +0200 Subject: [PATCH 3/5] Revert "Clean up hack." This reverts commit 138c7f615bef9994629d4aa283ae7f037dc0f14d. --- 3rdparty | 2 +- lib/base.php | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) mode change 120000 => 160000 3rdparty diff --git a/3rdparty b/3rdparty deleted file mode 120000 index ae24324a4bd..00000000000 --- a/3rdparty +++ /dev/null @@ -1 +0,0 @@ -/home/tol/owncloud/3rdparty/ \ No newline at end of file diff --git a/3rdparty b/3rdparty new file mode 160000 index 00000000000..a13af72fbe8 --- /dev/null +++ b/3rdparty @@ -0,0 +1 @@ +Subproject commit a13af72fbe8983686fc47489a750e60319f68ac2 diff --git a/lib/base.php b/lib/base.php index 42d8fb3c8d9..8622d0f8bf1 100644 --- a/lib/base.php +++ b/lib/base.php @@ -572,7 +572,6 @@ class OC { } OC::tryBasicAuthLogin(); - if (!self::$CLI) { try { if (!OC_Config::getValue('maintenance', false)) { @@ -680,8 +679,9 @@ class OC { $error[] = 'invalidpassword'; // The user is already authenticated using Apaches AuthType Basic... very usable in combination with LDAP + } elseif (OC::tryBasicAuthLogin()) { + $error[] = 'invalidpassword'; } - OC_Util::displayLoginPage(array_unique($error)); } @@ -779,6 +779,8 @@ class OC { if (OC_User::login($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) { //OC_Log::write('core',"Logged in with HTTP Authentication", OC_Log::DEBUG); OC_User::unsetMagicInCookie(); + $_REQUEST['redirect_url'] = OC_Request::requestUri(); + //OC_Util::redirectToDefaultPage(); } return true; } From ad5c4bf7717d96142d3b7a3526022e5bccecfdcc Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Fri, 31 May 2013 00:53:57 +0200 Subject: [PATCH 4/5] Cleanup hacke v.2 --- lib/base.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/base.php b/lib/base.php index 8622d0f8bf1..42d8fb3c8d9 100644 --- a/lib/base.php +++ b/lib/base.php @@ -572,6 +572,7 @@ class OC { } OC::tryBasicAuthLogin(); + if (!self::$CLI) { try { if (!OC_Config::getValue('maintenance', false)) { @@ -679,9 +680,8 @@ class OC { $error[] = 'invalidpassword'; // The user is already authenticated using Apaches AuthType Basic... very usable in combination with LDAP - } elseif (OC::tryBasicAuthLogin()) { - $error[] = 'invalidpassword'; } + OC_Util::displayLoginPage(array_unique($error)); } @@ -779,8 +779,6 @@ class OC { if (OC_User::login($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) { //OC_Log::write('core',"Logged in with HTTP Authentication", OC_Log::DEBUG); OC_User::unsetMagicInCookie(); - $_REQUEST['redirect_url'] = OC_Request::requestUri(); - //OC_Util::redirectToDefaultPage(); } return true; } From 9cd6645037dc802fc0e1bc87ac8fdce76243f09d Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Wed, 5 Jun 2013 00:38:08 +0200 Subject: [PATCH 5/5] Move comment and set requesttoken. --- lib/base.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/base.php b/lib/base.php index 42d8fb3c8d9..ab69b707d35 100644 --- a/lib/base.php +++ b/lib/base.php @@ -571,6 +571,7 @@ class OC { self::checkUpgrade(); } + // Test it the user is already authenticated using Apaches AuthType Basic... very usable in combination with LDAP OC::tryBasicAuthLogin(); if (!self::$CLI) { @@ -674,12 +675,9 @@ class OC { // remember was checked after last login if (OC::tryRememberLogin()) { $error[] = 'invalidcookie'; - // Someone wants to log in : } elseif (OC::tryFormLogin()) { $error[] = 'invalidpassword'; - - // The user is already authenticated using Apaches AuthType Basic... very usable in combination with LDAP } OC_Util::displayLoginPage(array_unique($error)); @@ -779,6 +777,7 @@ class OC { if (OC_User::login($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"])) { //OC_Log::write('core',"Logged in with HTTP Authentication", OC_Log::DEBUG); OC_User::unsetMagicInCookie(); + $_SERVER['HTTP_REQUESTTOKEN'] = OC_Util::callRegister(); } return true; }