misuzu/public-legacy/settings/logs.php

27 lines
972 B
PHP
Raw Normal View History

2022-09-13 13:14:49 +00:00
<?php
namespace Misuzu;
use Misuzu\Pagination;
$authInfo = $msz->getAuthInfo();
$currentUser = $authInfo->getUserInfo();
if($currentUser === null)
Template::throwError(401);
2022-09-13 13:14:49 +00:00
2023-09-08 00:43:00 +00:00
$authCtx = $msz->getAuthContext();
$loginAttempts = $authCtx->getLoginAttempts();
$auditLog = $msz->getAuditLog();
$loginHistoryPagination = new Pagination($loginAttempts->countAttempts(userInfo: $currentUser), 5, 'hp');
$accountLogPagination = new Pagination($auditLog->countLogs(userInfo: $currentUser), 10, 'ap');
2024-02-07 00:04:45 +00:00
$loginHistory = iterator_to_array($loginAttempts->getAttempts(userInfo: $currentUser, pagination: $loginHistoryPagination));
$auditLogs = iterator_to_array($auditLog->getLogs(userInfo: $currentUser, pagination: $accountLogPagination));
2022-09-13 13:14:49 +00:00
Template::render('settings.logs', [
'login_history_list' => $loginHistory,
2022-09-13 13:14:49 +00:00
'login_history_pagination' => $loginHistoryPagination,
'account_log_list' => $auditLogs,
2022-09-13 13:14:49 +00:00
'account_log_pagination' => $accountLogPagination,
]);