summaryrefslogtreecommitdiffstats
path: root/lib/base.php
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2016-04-18 12:14:07 +0200
committerLukas Reschke <lukas@owncloud.com>2016-04-18 21:21:52 +0200
commit8222ad515706d62cceb14428c959b83a69ccbc8b (patch)
tree1fb2a2a86d2eaebca7e48366a7b3e50d3f3dbe7f /lib/base.php
parent51975d360a93daba3b2681136a77b8d7078719e9 (diff)
downloadnextcloud-server-8222ad515706d62cceb14428c959b83a69ccbc8b.tar.gz
nextcloud-server-8222ad515706d62cceb14428c959b83a69ccbc8b.zip
Move logout to controller
Testable code. Yay.
Diffstat (limited to 'lib/base.php')
-rw-r--r--lib/base.php24
1 files changed, 3 insertions, 21 deletions
diff --git a/lib/base.php b/lib/base.php
index 27967588360..6bc0fecf04d 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -858,7 +858,7 @@ class OC {
}
}
- if (!self::$CLI and (!isset($_GET["logout"]) or ($_GET["logout"] !== 'true'))) {
+ if (!self::$CLI) {
try {
if (!$systemConfig->getValue('maintenance', false) && !self::checkUpgrade(false)) {
OC_App::loadApps(array('filesystem', 'logging'));
@@ -897,31 +897,13 @@ class OC {
return;
}
- // Redirect to index if the logout link is accessed without valid session
- // this is needed to prevent "Token expired" messages while login if a session is expired
- // @see https://github.com/owncloud/core/pull/8443#issuecomment-42425583
- if(isset($_GET['logout']) && !OC_User::isLoggedIn()) {
- header("Location: " . \OC::$server->getURLGenerator()->getAbsoluteURL('/'));
- return;
- }
-
// Someone is logged in
if (OC_User::isLoggedIn()) {
OC_App::loadApps();
OC_User::setupBackends();
OC_Util::setupFS();
- if (isset($_GET["logout"]) and ($_GET["logout"])) {
- OC_JSON::callCheck();
- if (isset($_COOKIE['oc_token'])) {
- \OC::$server->getConfig()->deleteUserValue(OC_User::getUser(), 'login_token', $_COOKIE['oc_token']);
- }
- OC_User::logout();
- // redirect to webroot and add slash if webroot is empty
- header("Location: " . \OC::$server->getURLGenerator()->getAbsoluteURL('/'));
- } else {
- // Redirect to default application
- OC_Util::redirectToDefaultPage();
- }
+ // Redirect to default application
+ OC_Util::redirectToDefaultPage();
} else {
// Not handled and not logged in
self::handleLogin();