[Web] Show users last PW change, allow to select n days for last logins

This commit is contained in:
andryyy
2021-06-09 07:19:57 +02:00
parent da20d5dc38
commit 47b57df3a2
11 changed files with 65 additions and 56 deletions

View File

@@ -72,17 +72,15 @@ jQuery(function($){
}
acl_data = JSON.parse(acl);
$('.clear-last-logins').on('click', function () {
if (confirm(lang.delete_ays)) {
last_logins('reset');
}
})
$('.clear-last-logins').on('click', function () {if (confirm(lang.delete_ays)) {last_logins('reset');}})
$(".login-history").on('click', function(e) {e.preventDefault(); last_logins('get', $(this).data('days'));$(this).addClass('active').siblings().removeClass('active');});
function last_logins(action, lines = 10) {
function last_logins(action, days = 7) {
if (action == 'get') {
$('.last-login').html('<i class="bi bi-hourglass"></i>' + lang.waiting);
$.ajax({
dataType: 'json',
url: '/api/v1/get/last-login/' + encodeURIComponent(mailcow_cc_username) + '/' + lines,
url: '/api/v1/get/last-login/' + encodeURIComponent(mailcow_cc_username) + '/' + days,
jsonp: false,
error: function () {
console.log('error reading last logins');