From 7a4560ee2863bc96ddf9382915eb238fd4c2fcbb Mon Sep 17 00:00:00 2001 From: andryyy Date: Tue, 24 Mar 2020 18:46:11 +0100 Subject: [PATCH] [Web] CSS fixes; Add OAUTH2_FORGET_SESSION_AFTER_LOGIN to vars.inc.php (wip); Do not run initdb on non-master cow --- data/web/css/site/quarantine.css | 6 ++---- data/web/inc/init_db.inc.php | 8 ++++++++ data/web/inc/prerequisites.inc.php | 1 + data/web/inc/vars.inc.php | 4 ++++ data/web/js/site/quarantine.js | 2 +- data/web/oauth/profile.php | 4 ++++ 6 files changed, 20 insertions(+), 5 deletions(-) diff --git a/data/web/css/site/quarantine.css b/data/web/css/site/quarantine.css index e7cdf271..7e46b814 100644 --- a/data/web/css/site/quarantine.css +++ b/data/web/css/site/quarantine.css @@ -15,10 +15,8 @@ table.footable>tbody>tr.footable-empty>td { overflow: visible !important; } -@media screen and (max-width: 1280px) { - .table-responsive { - overflow-x: scroll !important; - } +.table-responsive { + overflow-x: scroll !important; } .footer-add-item { diff --git a/data/web/inc/init_db.inc.php b/data/web/inc/init_db.inc.php index ff4edfce..84c2ae5a 100644 --- a/data/web/inc/init_db.inc.php +++ b/data/web/inc/init_db.inc.php @@ -12,6 +12,14 @@ function init_db_schema() { if ($stmt->fetch(PDO::FETCH_ASSOC)['version'] == $db_version) { return true; } + if (!preg_match('/y|yes/i', getenv('MASTER'))) { + $_SESSION['return'][] = array( + 'type' => 'warning', + 'log' => array(__FUNCTION__), + 'msg' => 'Database not initialized: not running db_init on slave.' + ); + return true; + } } $views = array( diff --git a/data/web/inc/prerequisites.inc.php b/data/web/inc/prerequisites.inc.php index ff58cce9..39c8c62a 100644 --- a/data/web/inc/prerequisites.inc.php +++ b/data/web/inc/prerequisites.inc.php @@ -3,6 +3,7 @@ // Slave does not serve UI if (!preg_match('/y|yes/i', getenv('MASTER'))) { header('Location: /SOGo', true, 307); + exit; } require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/vars.inc.php'; diff --git a/data/web/inc/vars.inc.php b/data/web/inc/vars.inc.php index 8e3e8d0c..45675d11 100644 --- a/data/web/inc/vars.inc.php +++ b/data/web/inc/vars.inc.php @@ -132,6 +132,8 @@ $ANONYMIZE_IPS = true; // OAuth2 settings $REFRESH_TOKEN_LIFETIME = 2678400; $ACCESS_TOKEN_LIFETIME = 86400; +// Logout from mailcow after first OAuth2 session profile request +$OAUTH2_FORGET_SESSION_AFTER_LOGIN = false; // MAILBOX_DEFAULT_ATTRIBUTES define default attributes for new mailboxes // These settings will not change existing mailboxes @@ -155,6 +157,8 @@ $MAILBOX_DEFAULT_ATTRIBUTES['quarantine_notification'] = 'hourly'; // Check dovecot.conf for further changes (e.g. shared namespace) $MAILBOX_DEFAULT_ATTRIBUTES['mailbox_format'] = 'maildir:'; + + // Set visible Rspamd maps in mailcow UI, do not change unless you know what you are doing $RSPAMD_MAPS = array( 'regex' => array( diff --git a/data/web/js/site/quarantine.js b/data/web/js/site/quarantine.js index 97154ed5..d25c0de6 100644 --- a/data/web/js/site/quarantine.js +++ b/data/web/js/site/quarantine.js @@ -57,7 +57,7 @@ jQuery(function($){ {"name":"score","title": lang.spam_score, "type": "text"}, {"name":"notified","title":lang.notified, "type": "text"}, {"name":"created","formatter":function unix_time_format(tm) { var date = new Date(tm ? tm * 1000 : 0); return date.toLocaleString();},"title":lang.received,"style":{"width":"170px"}}, - {"name":"action","filterable": false,"sortable": false,"style":{"text-align":"right"},"style":{"width":"220px"},"type":"html","title":lang.action,"breakpoints":"xs sm md"} + {"name":"action","filterable": false,"sortable": false,"style":{"text-align":"right"},"style":{"min-width":"200px"},"type":"html","title":lang.action,"breakpoints":"xs sm md"} ], "rows": $.ajax({ dataType: 'json', diff --git a/data/web/oauth/profile.php b/data/web/oauth/profile.php index 3628e58b..cf386149 100644 --- a/data/web/oauth/profile.php +++ b/data/web/oauth/profile.php @@ -24,6 +24,10 @@ if (!empty($mailbox)) { )); exit; } + if ($GLOBALS['OAUTH2_FORGET_SESSION_AFTER_LOGIN'] === true) { + session_unset(); + session_destroy(); + } } echo json_encode(array( 'success' => false