24 lines
1,008 B
PHP
24 lines
1,008 B
PHP
<?php
|
|
namespace Misuzu;
|
|
|
|
use Misuzu\Pagination;
|
|
|
|
if(!isset($msz) || !($msz instanceof \Misuzu\MisuzuContext))
|
|
die('Script must be called through the Misuzu route dispatcher.');
|
|
|
|
$currentUser = $msz->authInfo->userInfo;
|
|
if($currentUser === null)
|
|
Template::throwError(401);
|
|
|
|
$loginHistoryPagination = Pagination::fromInput($msz->authCtx->loginAttempts->countAttempts(userInfo: $currentUser), 5, 'hp');
|
|
$accountLogPagination = Pagination::fromInput($msz->auditLog->countLogs(userInfo: $currentUser), 10, 'ap');
|
|
|
|
$loginHistory = iterator_to_array($msz->authCtx->loginAttempts->getAttempts(userInfo: $currentUser, pagination: $loginHistoryPagination));
|
|
$auditLogs = iterator_to_array($msz->auditLog->getLogs(userInfo: $currentUser, pagination: $accountLogPagination));
|
|
|
|
Template::render('settings.logs', [
|
|
'login_history_list' => $loginHistory,
|
|
'login_history_pagination' => $loginHistoryPagination,
|
|
'account_log_list' => $auditLogs,
|
|
'account_log_pagination' => $accountLogPagination,
|
|
]);
|