From 1791383eab16e5c6f7640395e711aabcd7b6912a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= Date: Wed, 15 Aug 2018 00:05:18 +0200 Subject: [PATCH] [Web] Fix duplicate success message after editing a domain as domain administrator [Web] Add "login as" button for domain admin table --- data/web/inc/functions.mailbox.inc.php | 10 +++++----- data/web/inc/triggers.inc.php | 9 +++++++++ data/web/js/admin.js | 3 ++- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/data/web/inc/functions.mailbox.inc.php b/data/web/inc/functions.mailbox.inc.php index 82481cc3..92d55e8b 100644 --- a/data/web/inc/functions.mailbox.inc.php +++ b/data/web/inc/functions.mailbox.inc.php @@ -1906,12 +1906,12 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { ':description' => $description, ':domain' => $domain )); + $_SESSION['return'][] = array( + 'type' => 'success', + 'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr), + 'msg' => array('domain_modified', htmlspecialchars($domain)) + ); } - $_SESSION['return'][] = array( - 'type' => 'success', - 'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr), - 'msg' => array('domain_modified', htmlspecialchars($domain)) - ); } break; case 'mailbox': diff --git a/data/web/inc/triggers.inc.php b/data/web/inc/triggers.inc.php index 892d79fb..4df1beca 100644 --- a/data/web/inc/triggers.inc.php +++ b/data/web/inc/triggers.inc.php @@ -52,6 +52,15 @@ if (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == "admi header("Location: /user.php"); } } + else { + if (!empty(domain_admin('details', $duallogin))) { + $_SESSION["dual-login"]["username"] = $_SESSION['mailcow_cc_username']; + $_SESSION["dual-login"]["role"] = $_SESSION['mailcow_cc_role']; + $_SESSION['mailcow_cc_username'] = $duallogin; + $_SESSION['mailcow_cc_role'] = "domainadmin"; + header("Location: /user.php"); + } + } } } diff --git a/data/web/js/admin.js b/data/web/js/admin.js index f9f2867f..a4fe801e 100644 --- a/data/web/js/admin.js +++ b/data/web/js/admin.js @@ -27,7 +27,7 @@ jQuery(function($){ {"name":"selected_domains","title":lang.admin_domains,"breakpoints":"xs sm"}, {"name":"tfa_active","title":"TFA", "filterable": false,"style":{"maxWidth":"80px","width":"80px"}}, {"name":"active","filterable": false,"style":{"maxWidth":"80px","width":"80px"},"title":lang.active}, - {"name":"action","filterable": false,"sortable": false,"style":{"text-align":"right","maxWidth":"180px","width":"180px"},"type":"html","title":lang.action,"breakpoints":"xs sm"} + {"name":"action","filterable": false,"sortable": false,"style":{"text-align":"right","maxWidth":"250px","width":"250px"},"type":"html","title":lang.action,"breakpoints":"xs sm"} ], "rows": $.ajax({ dataType: 'json', @@ -130,6 +130,7 @@ jQuery(function($){ item.action = '
' + ' ' + lang.edit + '' + ' ' + lang.remove + '' + + ' Login' + '
'; }); }