misuzu/public-legacy/settings/logs.php

29 lines
893 B
PHP

<?php
namespace Misuzu;
use Misuzu\Pagination;
use Misuzu\Users\User;
$currentUser = User::getCurrent();
if($currentUser === null) {
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);
Template::render('settings.logs', [
'login_history_list' => $loginHistory,
'login_history_pagination' => $loginHistoryPagination,
'account_log_list' => $auditLogs,
'account_log_pagination' => $accountLogPagination,
]);