2022-09-13 13:14:49 +00:00
|
|
|
<?php
|
|
|
|
namespace Misuzu;
|
|
|
|
|
|
|
|
use Misuzu\Pagination;
|
|
|
|
|
2023-08-02 22:12:47 +00:00
|
|
|
$currentUser = $msz->getActiveUser();
|
2022-09-13 13:14:49 +00:00
|
|
|
if($currentUser === null) {
|
|
|
|
echo render_error(401);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-07-22 16:37:57 +00:00
|
|
|
$loginAttempts = $msz->getLoginAttempts();
|
2023-07-17 17:43:17 +00:00
|
|
|
$auditLog = $msz->getAuditLog();
|
|
|
|
|
2023-07-22 16:37:57 +00:00
|
|
|
$loginHistoryPagination = new Pagination($loginAttempts->countAttempts(userInfo: $currentUser), 5, 'hp');
|
|
|
|
$accountLogPagination = new Pagination($auditLog->countLogs(userInfo: $currentUser), 10, 'ap');
|
2023-07-17 17:43:17 +00:00
|
|
|
|
2023-07-22 16:37:57 +00:00
|
|
|
$loginHistory = $loginAttempts->getAttempts(userInfo: $currentUser, pagination: $loginHistoryPagination);
|
2023-07-17 17:43:17 +00:00
|
|
|
$auditLogs = $auditLog->getLogs(userInfo: $currentUser, pagination: $accountLogPagination);
|
2022-09-13 13:14:49 +00:00
|
|
|
|
|
|
|
Template::render('settings.logs', [
|
2023-07-22 16:37:57 +00:00
|
|
|
'login_history_list' => $loginHistory,
|
2022-09-13 13:14:49 +00:00
|
|
|
'login_history_pagination' => $loginHistoryPagination,
|
2023-07-17 17:43:17 +00:00
|
|
|
'account_log_list' => $auditLogs,
|
2022-09-13 13:14:49 +00:00
|
|
|
'account_log_pagination' => $accountLogPagination,
|
|
|
|
]);
|