misuzu/public-legacy/settings/logs.php

28 lines
814 B
PHP
Raw Normal View History

2019-06-06 20:09:27 +00:00
<?php
namespace Misuzu;
2020-05-21 15:05:30 +00:00
use Misuzu\Pagination;
use Misuzu\Users\User;
2020-05-25 14:15:17 +00:00
use Misuzu\Users\UserLoginAttempt;
2020-05-21 15:05:30 +00:00
2020-05-25 14:15:17 +00:00
$currentUser = User::getCurrent();
if($currentUser === null) {
2019-06-06 20:09:27 +00:00
echo render_error(401);
return;
}
$auditLog = $msz->getAuditLog();
2020-05-25 14:15:17 +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);
2019-06-06 20:09:27 +00:00
Template::render('settings.logs', [
2020-05-25 14:15:17 +00:00
'login_history_list' => UserLoginAttempt::all($loginHistoryPagination, $currentUser),
2019-06-06 20:09:27 +00:00
'login_history_pagination' => $loginHistoryPagination,
'account_log_list' => $auditLogs,
2019-06-06 20:09:27 +00:00
'account_log_pagination' => $accountLogPagination,
]);