misuzu/public/settings/logs.php

30 lines
848 B
PHP
Raw Permalink Normal View History

2022-09-13 13:14:49 +00:00
<?php
namespace Misuzu;
use Misuzu\Pagination;
use Misuzu\Users\User;
use Misuzu\Users\UserLoginAttempt;
require_once '../../misuzu.php';
$currentUser = User::getCurrent();
if($currentUser === null) {
echo render_error(401);
return;
}
$auditLog = $msz->getAuditLog();
2022-09-13 13:14:49 +00:00
$loginHistoryPagination = new Pagination(UserLoginAttempt::countAll($currentUser), 15, 'hp');
$accountLogPagination = new Pagination($auditLog->countLogs(userInfo: $currentUser), 15, 'ap');
$auditLogs = $auditLog->getLogs(userInfo: $currentUser, pagination: $accountLogPagination);
2022-09-13 13:14:49 +00:00
Template::render('settings.logs', [
'login_history_list' => UserLoginAttempt::all($loginHistoryPagination, $currentUser),
'login_history_pagination' => $loginHistoryPagination,
'account_log_list' => $auditLogs,
2022-09-13 13:14:49 +00:00
'account_log_pagination' => $accountLogPagination,
]);