From 15a3ed02ba5a519c7ccb95f92bf4290b0300fc59 Mon Sep 17 00:00:00 2001 From: Fabian Jakobs Date: Wed, 28 Oct 2015 14:45:53 +0000 Subject: [PATCH] logout redirects --- plugins/c9.ide.auth/auth.js | 17 +++-------------- plugins/c9.ide.login/login.js | 6 ++---- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/plugins/c9.ide.auth/auth.js b/plugins/c9.ide.auth/auth.js index 0b88d862..c9070189 100644 --- a/plugins/c9.ide.auth/auth.js +++ b/plugins/c9.ide.auth/auth.js @@ -107,20 +107,9 @@ define(function(require, exports, module) { }) || true; } - function logout(callback) { - accessToken = "invalid"; - loggingIn = false; - - http.request("/_auth/logout", function(err1) { - http.request(ideBaseUrl + "/auth/signout", { - method: "POST", - withCredentials: true - }, function(err2) { - loggedIn = false; - emit("logout", {uid: uid, newUid: ANONYMOUS}); - callback && callback(err1 || err2); - }); - }); + function logout(redirect) { + redirect = redirect || window.location.href; + window.location.href = ideBaseUrl + "/auth/signout?redirect=" + encodeURIComponent(redirect); } function createLoopDetector(count, duration) { diff --git a/plugins/c9.ide.login/login.js b/plugins/c9.ide.login/login.js index 817480a5..2f78e138 100644 --- a/plugins/c9.ide.login/login.js +++ b/plugins/c9.ide.login/login.js @@ -137,7 +137,7 @@ define(function(require, exports, module) { function signout() { vfsEndpoint.clearCache(); - auth.logout(function() { location.href = ideBaseUrl; }); + auth.logout(ideBaseUrl); } function onReLogin() { @@ -147,9 +147,7 @@ define(function(require, exports, module) { "Please hit OK to reload the IDE.", function() { vfsEndpoint.clearCache(); - auth.logout(function() { - document.location.reload(); - }); + auth.logout(); }); } }