From e0fdcaa95977514cb0051a5e4ce95734bbb19aa8 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Fri, 18 Oct 2019 14:17:27 +0200 Subject: [PATCH] Call on logout event when any sort of logout happens --- api/js/framework/fw_desktop.js | 21 +++++++++++++-------- json.php | 1 + 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/api/js/framework/fw_desktop.js b/api/js/framework/fw_desktop.js index 8ead0a4d9e..c6cb0b649a 100644 --- a/api/js/framework/fw_desktop.js +++ b/api/js/framework/fw_desktop.js @@ -404,18 +404,12 @@ et2_loadingFinished: function() { this.checkTabOverflow(); var $logout = jQuery('#topmenu_logout'); + var self = this; if (!$logout.hasClass('onLogout')) { $logout.on('click', function(e){ e.preventDefault(); - var apps = Object.keys(framework.applications); - for(var i in apps) - { - if (app[apps[i]] && typeof app[apps[i]].onLogout === "function") - { - app[apps[i]].onLogout.call(e); - } - } + self.callOnLogout(e); window.framework.redirect(this.href); }); $logout.addClass('onLogout'); @@ -502,6 +496,17 @@ $body.off('click'); } $menu.toggle(); + }, + + callOnLogout: function(e) { + var apps = Object.keys(framework.applications); + for(var i in apps) + { + if (app[apps[i]] && typeof app[apps[i]].onLogout === "function") + { + app[apps[i]].onLogout.call(e); + } + } } }); })(window); diff --git a/json.php b/json.php index 859572a2a1..1b8407369d 100644 --- a/json.php +++ b/json.php @@ -29,6 +29,7 @@ function login_redirect(&$anon_account) } Json\Request::isJSONRequest(true); // because Api\Json\Request::parseRequest() is not (yet) called $response = Json\Response::get(); + $response->apply('framework.callOnLogout'); $response->redirect($GLOBALS['egw_info']['server']['webserver_url'].'/login.php?cd=10', true); exit();