From 9c4693365a2b8c4a622312e3921bd5abf0cbc691 Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 24 Feb 2020 18:36:53 -0500 Subject: [PATCH] logout-everywhere from the userAdmin menu --- www/common/common-ui-elements.js | 11 +++++++++++ www/common/sframe-common-outer.js | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 6c581386d..de7009c52 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -3321,6 +3321,13 @@ define([ options.push({ tag: 'hr' }); // Add login or logout button depending on the current status if (accountName) { + options.push({ + tag: 'a', + attributes: { + 'class': 'cp-toolbar-menu-logout-everywhere fa fa-plug', + }, + content: h('span', "CLOSE REMOTE SESSIONS") // XXX Messages.settings_logoutEverywhereTitle) + }); options.push({ tag: 'a', attributes: {'class': 'cp-toolbar-menu-logout fa fa-sign-out'}, @@ -3407,6 +3414,10 @@ define([ window.parent.location = origin+'/'; }); }); + + $userAdmin.find('a.cp-toolbar-menu-logout-everywhere').click(function () { + Common.getSframeChannel().query('Q_LOGOUT_EVERYWHERE', null, function () { }); + }); $userAdmin.find('a.cp-toolbar-menu-settings').click(function () { if (padType) { window.open(origin+'/settings/'); diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index 313bf98c5..2074076f9 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -783,6 +783,10 @@ define([ Utils.LocalStore.logout(cb); }); + sframeChan.on('Q_LOGOUT_EVERYWHERE', function (data, cb) { + Cryptpad.logoutFromAll(cb); + }); + sframeChan.on('EV_NOTIFY', function (data) { Notifier.notify(data); });