misuzu/public-legacy/settings/logs.php

27 lines
872 B
PHP
Raw Normal View History

2019-06-06 20:09:27 +00:00
<?php
namespace Misuzu;
2020-05-21 15:05:30 +00:00
use Misuzu\Pagination;
2020-05-25 14:15:17 +00:00
$currentUser = $msz->getActiveUser();
2020-05-25 14:15:17 +00:00
if($currentUser === null) {
2019-06-06 20:09:27 +00:00
echo render_error(401);
return;
}
$loginAttempts = $msz->getLoginAttempts();
$auditLog = $msz->getAuditLog();
$loginHistoryPagination = new Pagination($loginAttempts->countAttempts(userInfo: $currentUser), 5, 'hp');
$accountLogPagination = new Pagination($auditLog->countLogs(userInfo: $currentUser), 10, 'ap');
$loginHistory = $loginAttempts->getAttempts(userInfo: $currentUser, pagination: $loginHistoryPagination);
$auditLogs = $auditLog->getLogs(userInfo: $currentUser, pagination: $accountLogPagination);
2019-06-06 20:09:27 +00:00
Template::render('settings.logs', [
'login_history_list' => $loginHistory,
2019-06-06 20:09:27 +00:00
'login_history_pagination' => $loginHistoryPagination,
'account_log_list' => $auditLogs,
2019-06-06 20:09:27 +00:00
'account_log_pagination' => $accountLogPagination,
]);