[Postfix, Web] Feature: Show last SMTP login

This commit is contained in:
andryyy
2020-09-15 11:02:53 +02:00
parent 28041b1d97
commit 1f36ae28d4
7 changed files with 49 additions and 7 deletions

View File

@@ -57,7 +57,13 @@ table tbody tr {
table tbody tr td input[type="checkbox"] {
cursor: pointer;
}
.label-last {
color: #c7254e !important;
background-color: #f9f2f4 !important;
.label-last-in {
line-height: 2.5;
color: #4a4a4a!important;
background-color: #ececec!important;
}
.label-last-out {
line-height: 2.5;
color: #ececec!important;
background-color: #a0a0a0!important;
}

View File

@@ -3345,10 +3345,14 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
$mailboxdata = array();
$rl = ratelimit('get', 'mailbox', $_data);
$last_imap_login = $redis->Get('last-login/imap/' . $_data);
$last_smtp_login = $redis->Get('last-login/smtp/' . $_data);
$last_pop3_login = $redis->Get('last-login/pop3/' . $_data);
if ($last_imap_login === false || $GLOBALS['SHOW_LAST_LOGIN'] === false) {
$last_imap_login = '0';
}
if ($last_smtp_login === false || $GLOBALS['SHOW_LAST_LOGIN'] === false) {
$last_smtp_login = '0';
}
if ($last_pop3_login === false || $GLOBALS['SHOW_LAST_LOGIN'] === false) {
$last_pop3_login = '0';
}
@@ -3416,6 +3420,7 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
$mailboxdata['is_relayed'] = $row['backupmx'];
$mailboxdata['name'] = $row['name'];
$mailboxdata['last_imap_login'] = $last_imap_login;
$mailboxdata['last_smtp_login'] = $last_smtp_login;
$mailboxdata['last_pop3_login'] = $last_pop3_login;
$mailboxdata['active'] = $row['active'];
$mailboxdata['active_int'] = $row['active_int'];

View File

@@ -363,8 +363,9 @@ jQuery(function($){
},
"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>';
return '<div class="label label-last-in">IMAP @ ' + unix_time_format(Number(res[0])) + '</div><br>' +
'<div class="label label-last-in">POP3 @ ' + unix_time_format(Number(res[1])) + '</div><br>' +
'<div class="label label-last-out">SMTP @ ' + unix_time_format(Number(res[2])) + '</div>';
}},
{"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){
@@ -388,7 +389,7 @@ jQuery(function($){
$.each(data, function (i, item) {
item.quota = item.quota_used + "/" + item.quota;
item.max_quota_for_mbox = humanFileSize(item.max_quota_for_mbox);
item.last_mail_login = item.last_imap_login + '/' + item.last_pop3_login;
item.last_mail_login = item.last_imap_login + '/' + item.last_pop3_login + '/' + item.last_smtp_login;
if (!item.rl) {
item.rl = '∞';
} else {