diff --git a/data/conf/dovecot/dovecot.conf b/data/conf/dovecot/dovecot.conf index 8f8d9f2e..5285d9c1 100644 --- a/data/conf/dovecot/dovecot.conf +++ b/data/conf/dovecot/dovecot.conf @@ -359,7 +359,7 @@ plugin { acl_shared_dict = file:/var/vmail/shared-mailboxes.db acl = vfile last_login_dict=Get('last-login/' . $_data); - if ($last_mail_login === false) { - $last_mail_login = ''; + $last_imap_login = $redis->Get('last-login/imap/' . $_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_pop3_login === false || $GLOBALS['SHOW_LAST_LOGIN'] === false) { + $last_pop3_login = '0'; } if (preg_match('/y|yes/i', getenv('MASTER'))) { $stmt = $pdo->prepare("SELECT @@ -3397,7 +3401,8 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { } $mailboxdata['is_relayed'] = $row['backupmx']; $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_int'] = $row['active_int']; $mailboxdata['domain'] = $row['domain']; diff --git a/data/web/inc/vars.inc.php b/data/web/inc/vars.inc.php index 45675d11..95adcfff 100644 --- a/data/web/inc/vars.inc.php +++ b/data/web/inc/vars.inc.php @@ -157,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:'; +// 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 diff --git a/data/web/js/site/mailbox.js b/data/web/js/site/mailbox.js index 11976567..36c1b30d 100644 --- a/data/web/js/site/mailbox.js +++ b/data/web/js/site/mailbox.js @@ -204,6 +204,7 @@ jQuery(function($){ function escapeHtml(n){return String(n).replace(/[&<>"'`=\/]/g,function(n){return entityMap[n]})} // 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