[Web] Show last 7 days per default in sasl logs table for user

master
andryyy 2021-10-30 16:56:04 +02:00
parent 9946bb3427
commit 77281629b9
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
2 changed files with 4 additions and 4 deletions

View File

@ -79,7 +79,7 @@ jQuery(function($){
$('.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, days = 1) {
function last_logins(action, days = 7) {
if (action == 'get') {
$('.last-login').html('<i class="bi bi-hourglass"></i>' + lang.waiting);
$.ajax({
@ -102,7 +102,7 @@ jQuery(function($){
var datetime = new Date(item.datetime.replace(/-/g, "/"));
var local_datetime = datetime.toLocaleDateString(undefined, {year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit"});
var service = '<div class="label label-default">' + item.service.toUpperCase() + '</div>';
var app_password = item.app_password ? ' <a href="/edit/app-passwd/' + item.app_password + '"><i class="bi bi-pen"></i> ' + escapeHtml(item.app_password_name || "App") + '</a>' : '';
var app_password = item.app_password ? ' <a href="/edit/app-passwd/' + item.app_password + '"><i class="bi bi-app-indicator"></i> ' + escapeHtml(item.app_password_name || "App") + '</a>' : '';
var real_rip = item.real_rip.startsWith("Web") ? item.real_rip : '<a href="https://bgp.he.net/ip/' + item.real_rip + '" target="_blank">' + item.real_rip + "</a>";
var ip_location = item.location ? ' <span class="flag-icon flag-icon-' + item.location.toLowerCase() + '"></span>' : '';
var ip_data = real_rip + ip_location + app_password;

View File

@ -102,8 +102,8 @@
<div class="dropdown pull-left pull-xs-right">
<button class="btn btn-default btn-xs btn-xs-lg dropdown-toggle" type="button" id="history_sasl_days" data-toggle="dropdown">{{ lang.user.login_history }} <span class="caret"></span></button>
<ul class="dropdown-menu">
<li class="login-history active" data-days="1"><a href="#">1 {{ lang.user.day }}</a></li>
<li class="login-history" data-days="7"><a href="#">1 {{ lang.user.week }}</a></li>
<li class="login-history" data-days="1"><a href="#">1 {{ lang.user.day }}</a></li>
<li class="login-history active" data-days="7"><a href="#">1 {{ lang.user.week }}</a></li>
<li class="login-history" data-days="14"><a href="#">2 {{ lang.user.weeks }}</a></li>
<li class="login-history" data-days="31"><a href="#">1 {{ lang.user.month }}</a></li>
</ul>