2019-06-06 20:09:27 +00:00
|
|
|
<?php
|
2019-09-28 22:43:51 +00:00
|
|
|
namespace Misuzu;
|
|
|
|
|
2020-05-21 15:05:30 +00:00
|
|
|
use Misuzu\AuditLog;
|
|
|
|
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
|
|
|
|
2019-06-06 20:09:27 +00:00
|
|
|
require_once '../../misuzu.php';
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2020-05-25 14:15:17 +00:00
|
|
|
$loginHistoryPagination = new Pagination(UserLoginAttempt::countAll($currentUser), 15, 'hp');
|
2020-05-21 15:05:30 +00:00
|
|
|
$accountLogPagination = new Pagination(AuditLog::countAll($currentUser), 15, 'ap');
|
2019-06-06 20:09:27 +00:00
|
|
|
|
2019-12-04 18:16:22 +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,
|
2020-05-21 15:05:30 +00:00
|
|
|
'account_log_list' => AuditLog::all($accountLogPagination, $currentUser),
|
2019-06-06 20:09:27 +00:00
|
|
|
'account_log_pagination' => $accountLogPagination,
|
|
|
|
]);
|