[Web, Dovecot] Show last IMAP and POP3 logins, toggle via vars.inc.php SHOW_LAST_LOGIN
parent
7753a8324f
commit
59a2ea0959
|
@ -359,7 +359,7 @@ plugin {
|
||||||
acl_shared_dict = file:/var/vmail/shared-mailboxes.db
|
acl_shared_dict = file:/var/vmail/shared-mailboxes.db
|
||||||
acl = vfile
|
acl = vfile
|
||||||
last_login_dict=</etc/dovecot/last_login
|
last_login_dict=</etc/dovecot/last_login
|
||||||
last_login_key = last-login/%u
|
last_login_key = last-login/%s/%u
|
||||||
fts = solr
|
fts = solr
|
||||||
fts_autoindex = yes
|
fts_autoindex = yes
|
||||||
fts_solr = url=http://solr:8983/solr/dovecot-fts/
|
fts_solr = url=http://solr:8983/solr/dovecot-fts/
|
||||||
|
|
|
@ -57,3 +57,7 @@ table tbody tr {
|
||||||
table tbody tr td input[type="checkbox"] {
|
table tbody tr td input[type="checkbox"] {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
.label-last {
|
||||||
|
color: #c7254e !important;
|
||||||
|
background-color: #f9f2f4 !important;
|
||||||
|
}
|
|
@ -3330,9 +3330,13 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
||||||
}
|
}
|
||||||
$mailboxdata = array();
|
$mailboxdata = array();
|
||||||
$rl = ratelimit('get', 'mailbox', $_data);
|
$rl = ratelimit('get', 'mailbox', $_data);
|
||||||
$last_mail_login = $redis->Get('last-login/' . $_data);
|
$last_imap_login = $redis->Get('last-login/imap/' . $_data);
|
||||||
if ($last_mail_login === false) {
|
$last_pop3_login = $redis->Get('last-login/pop3/' . $_data);
|
||||||
$last_mail_login = '';
|
if ($last_imap_login === false || $GLOBALS['SHOW_LAST_LOGIN'] === false) {
|
||||||
|
$last_imap_login = '0';
|
||||||
|
}
|
||||||
|
if ($last_pop3_login === false || $GLOBALS['SHOW_LAST_LOGIN'] === false) {
|
||||||
|
$last_pop3_login = '0';
|
||||||
}
|
}
|
||||||
if (preg_match('/y|yes/i', getenv('MASTER'))) {
|
if (preg_match('/y|yes/i', getenv('MASTER'))) {
|
||||||
$stmt = $pdo->prepare("SELECT
|
$stmt = $pdo->prepare("SELECT
|
||||||
|
@ -3397,7 +3401,8 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
|
||||||
}
|
}
|
||||||
$mailboxdata['is_relayed'] = $row['backupmx'];
|
$mailboxdata['is_relayed'] = $row['backupmx'];
|
||||||
$mailboxdata['name'] = $row['name'];
|
$mailboxdata['name'] = $row['name'];
|
||||||
$mailboxdata['last_mail_login'] = $last_mail_login;
|
$mailboxdata['last_imap_login'] = $last_imap_login;
|
||||||
|
$mailboxdata['last_pop3_login'] = $last_pop3_login;
|
||||||
$mailboxdata['active'] = $row['active'];
|
$mailboxdata['active'] = $row['active'];
|
||||||
$mailboxdata['active_int'] = $row['active_int'];
|
$mailboxdata['active_int'] = $row['active_int'];
|
||||||
$mailboxdata['domain'] = $row['domain'];
|
$mailboxdata['domain'] = $row['domain'];
|
||||||
|
|
|
@ -157,6 +157,8 @@ $MAILBOX_DEFAULT_ATTRIBUTES['quarantine_notification'] = 'hourly';
|
||||||
// Check dovecot.conf for further changes (e.g. shared namespace)
|
// Check dovecot.conf for further changes (e.g. shared namespace)
|
||||||
$MAILBOX_DEFAULT_ATTRIBUTES['mailbox_format'] = 'maildir:';
|
$MAILBOX_DEFAULT_ATTRIBUTES['mailbox_format'] = 'maildir:';
|
||||||
|
|
||||||
|
// Show last IMAP and POP3 logins
|
||||||
|
$SHOW_LAST_LOGIN = true;
|
||||||
|
|
||||||
|
|
||||||
// Set visible Rspamd maps in mailcow UI, do not change unless you know what you are doing
|
// Set visible Rspamd maps in mailcow UI, do not change unless you know what you are doing
|
||||||
|
|
|
@ -204,6 +204,7 @@ jQuery(function($){
|
||||||
function escapeHtml(n){return String(n).replace(/[&<>"'`=\/]/g,function(n){return entityMap[n]})}
|
function escapeHtml(n){return String(n).replace(/[&<>"'`=\/]/g,function(n){return entityMap[n]})}
|
||||||
// http://stackoverflow.com/questions/46155/validate-email-address-in-javascript
|
// http://stackoverflow.com/questions/46155/validate-email-address-in-javascript
|
||||||
function humanFileSize(i){if(Math.abs(i)<1024)return i+" B";var B=["KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],e=-1;do{i/=1024,++e}while(Math.abs(i)>=1024&&e<B.length-1);return i.toFixed(1)+" "+B[e]}
|
function humanFileSize(i){if(Math.abs(i)<1024)return i+" B";var B=["KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],e=-1;do{i/=1024,++e}while(Math.abs(i)>=1024&&e<B.length-1);return i.toFixed(1)+" "+B[e]}
|
||||||
|
function unix_time_format(i){return""==i?lang.no:new Date(i?1e3*i:0).toLocaleDateString(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}
|
||||||
$(".refresh_table").on('click', function(e) {
|
$(".refresh_table").on('click', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var table_name = $(this).data('table');
|
var table_name = $(this).data('table');
|
||||||
|
@ -245,17 +246,11 @@ jQuery(function($){
|
||||||
"sortValue": function(value){
|
"sortValue": function(value){
|
||||||
res = value.split("/");
|
res = value.split("/");
|
||||||
return Number(res[0]);
|
return Number(res[0]);
|
||||||
},
|
}},
|
||||||
},
|
{"name":"stats","sortable": false,"style":{"whiteSpace":"nowrap"},"title":lang.stats,"formatter": function(value){
|
||||||
{"name":"stats","style":{"whiteSpace":"nowrap"},"title":lang.stats,"formatter": function(value){
|
|
||||||
res = value.split("/");
|
res = value.split("/");
|
||||||
return '<span class="glyphicon glyphicon-file" aria-hidden="true"></span> ' + res[0] + ' / ' + humanFileSize(res[1]);
|
return '<span class="glyphicon glyphicon-file" aria-hidden="true"></span> ' + res[0] + ' / ' + humanFileSize(res[1]);
|
||||||
},
|
}},
|
||||||
"sortValue": function(value){
|
|
||||||
res = value.split("/");
|
|
||||||
return Number(res[0]);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{"name":"def_quota_for_mbox","title":lang.mailbox_defquota,"breakpoints":"xs sm md","style":{"width":"125px"}},
|
{"name":"def_quota_for_mbox","title":lang.mailbox_defquota,"breakpoints":"xs sm md","style":{"width":"125px"}},
|
||||||
{"name":"max_quota_for_mbox","title":lang.mailbox_quota,"breakpoints":"xs sm","style":{"width":"125px"}},
|
{"name":"max_quota_for_mbox","title":lang.mailbox_quota,"breakpoints":"xs sm","style":{"width":"125px"}},
|
||||||
{"name":"rl","title":"RL","breakpoints":"xs sm md lg","style":{"maxWidth":"100px","width":"100px"}},
|
{"name":"rl","title":"RL","breakpoints":"xs sm md lg","style":{"maxWidth":"100px","width":"100px"}},
|
||||||
|
@ -361,7 +356,16 @@ jQuery(function($){
|
||||||
{"name":"spam_aliases","filterable": false,"title":lang.spam_aliases,"breakpoints":"all"},
|
{"name":"spam_aliases","filterable": false,"title":lang.spam_aliases,"breakpoints":"all"},
|
||||||
{"name":"tls_enforce_in","filterable": false,"title":lang.tls_enforce_in,"breakpoints":"all"},
|
{"name":"tls_enforce_in","filterable": false,"title":lang.tls_enforce_in,"breakpoints":"all"},
|
||||||
{"name":"tls_enforce_out","filterable": false,"title":lang.tls_enforce_out,"breakpoints":"all"},
|
{"name":"tls_enforce_out","filterable": false,"title":lang.tls_enforce_out,"breakpoints":"all"},
|
||||||
{"name":"last_mail_login","breakpoints":"xs sm","formatter":function unix_time_format(tm) { if (tm == '') { return lang.no; } else { var date = new Date(tm ? tm * 1000 : 0); return date.toLocaleDateString(undefined, {year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit"}); }},"title":lang.last_mail_login,"style":{"width":"170px"}},
|
{"name":"last_mail_login","breakpoints":"xs sm","title":lang.last_mail_login,"style":{"width":"170px"},
|
||||||
|
"sortValue": function(value){
|
||||||
|
res = value.split("/");
|
||||||
|
return Math.max(res[0], res[1]);
|
||||||
|
},
|
||||||
|
"formatter": function(value){
|
||||||
|
res = value.split("/");
|
||||||
|
return '<div class="label label-last">IMAP @ ' + unix_time_format(Number(res[0])) + '</div> ' +
|
||||||
|
'<div class="label label-last">POP3 @ ' + unix_time_format(Number(res[1])) + '</div>';
|
||||||
|
}},
|
||||||
{"name":"quarantine_notification","filterable": false,"title":lang.quarantine_notification,"breakpoints":"all"},
|
{"name":"quarantine_notification","filterable": false,"title":lang.quarantine_notification,"breakpoints":"all"},
|
||||||
{"name":"in_use","filterable": false,"type":"html","title":lang.in_use,"sortValue": function(value){
|
{"name":"in_use","filterable": false,"type":"html","title":lang.in_use,"sortValue": function(value){
|
||||||
return Number($(value).find(".progress-bar-mailbox").attr('aria-valuenow'));
|
return Number($(value).find(".progress-bar-mailbox").attr('aria-valuenow'));
|
||||||
|
@ -384,6 +388,7 @@ jQuery(function($){
|
||||||
$.each(data, function (i, item) {
|
$.each(data, function (i, item) {
|
||||||
item.quota = item.quota_used + "/" + item.quota;
|
item.quota = item.quota_used + "/" + item.quota;
|
||||||
item.max_quota_for_mbox = humanFileSize(item.max_quota_for_mbox);
|
item.max_quota_for_mbox = humanFileSize(item.max_quota_for_mbox);
|
||||||
|
item.last_mail_login = item.last_imap_login + '/' + item.last_pop3_login;
|
||||||
if (!item.rl) {
|
if (!item.rl) {
|
||||||
item.rl = '∞';
|
item.rl = '∞';
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue