Adding option to log users ips
This commit is contained in:
@@ -40,6 +40,26 @@
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="settings-toggle" style="background: rgba(0,0,0,0.2); padding: 15px; border-radius: 4px; display: flex; align-items: center; justify-content: space-between; margin-top: 10px;">
|
||||
<div>
|
||||
<label style="display: block; font-weight: bold; color: var(--accent);">Log User IPs</label>
|
||||
<p style="margin: 2px 0 0 0; font-size: 0.8em; color: #aaa;">Log all historical IPs for user accounts.</p>
|
||||
</div>
|
||||
<label class="switch">
|
||||
<input type="checkbox" id="log_user_ips_toggle" {{ log_user_ips ? 'checked' : '' }} onchange="saveAdminSettings()">
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="settings-toggle" style="background: rgba(0,0,0,0.2); padding: 15px; border-radius: 4px; display: flex; align-items: center; justify-content: space-between; margin-top: 10px;">
|
||||
<div>
|
||||
<label style="display: block; font-weight: bold; color: var(--accent);">Hash User IPs</label>
|
||||
<p style="margin: 2px 0 0 0; font-size: 0.8em; color: #aaa;">Anonymize IPs by hashing them (same as failed logins).</p>
|
||||
</div>
|
||||
<label class="switch">
|
||||
<input type="checkbox" id="hash_user_ips_toggle" {{ hash_user_ips ? 'checked' : '' }} onchange="saveAdminSettings()">
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@if(registration_web_toggle_enabled)
|
||||
<div class="settings-toggle" style="background: rgba(0,0,0,0.2); padding: 15px; border-radius: 4px; display: flex; align-items: center; justify-content: space-between; margin-top: 10px;">
|
||||
@@ -99,6 +119,8 @@
|
||||
const status = document.getElementById('settings-status');
|
||||
const approvalToggle = document.getElementById('manual_approval_toggle');
|
||||
const registrationToggle = document.getElementById('registration_open_toggle');
|
||||
const logIpsToggle = document.getElementById('log_user_ips_toggle');
|
||||
const hashIpsToggle = document.getElementById('hash_user_ips_toggle');
|
||||
const minTagsInput = document.getElementById('min_tags_input');
|
||||
const trustedUploadsInput = document.getElementById('trusted_uploads_input');
|
||||
|
||||
@@ -114,6 +136,8 @@
|
||||
},
|
||||
body: new URLSearchParams({
|
||||
manual_approval: approvalToggle.checked ? 'on' : 'off',
|
||||
log_user_ips: logIpsToggle.checked ? 'on' : 'off',
|
||||
hash_user_ips: hashIpsToggle.checked ? 'on' : 'off',
|
||||
...(registrationToggle ? { registration_open: registrationToggle.checked ? 'on' : 'off' } : {}),
|
||||
min_tags: minTagsInput.value,
|
||||
trusted_uploads: trustedUploadsInput.value,
|
||||
|
||||
@@ -30,6 +30,12 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="session-body">
|
||||
@if(log_user_ips)
|
||||
<div class="session-info">
|
||||
<span class="label">IP:</span>
|
||||
<span class="value">{{ s.ip || 'unknown' }}</span>
|
||||
</div>
|
||||
@endif
|
||||
<div class="session-info">
|
||||
<span class="label">Browser:</span>
|
||||
<span class="value browser-info" title="{{ s.browser }}">{{ s.browser }}</span>
|
||||
|
||||
56
views/admin/user_ips.html
Normal file
56
views/admin/user_ips.html
Normal file
@@ -0,0 +1,56 @@
|
||||
@include(snippets/header)
|
||||
|
||||
<div class="pagewrapper">
|
||||
<div id="main" class="admin-container">
|
||||
<div class="container">
|
||||
<div style="margin-bottom: 30px;">
|
||||
<a href="/admin/users" style="color: #888; text-decoration: none; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 5px; margin-bottom: 15px;">
|
||||
<i class="fa fa-arrow-left"></i> Back to User Manager
|
||||
</a>
|
||||
<h2 style="margin: 0; font-weight: 800; letter-spacing: -0.5px;">IP History: {!! targetUser.user !!}</h2>
|
||||
<p style="color: #888; margin: 5px 0 0 0;">Historical IP addresses associated with this account.</p>
|
||||
</div>
|
||||
|
||||
<div class="upload-form">
|
||||
<table class="admin-ips-table responsive-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>IP Address</th>
|
||||
<th>First Seen</th>
|
||||
<th>Last Seen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if(ips && ips.length > 0)
|
||||
@each(ips as row)
|
||||
<tr>
|
||||
<td data-label="IP Address"><span class="ip-badge">{{ row.ip }}</span></td>
|
||||
<td data-label="First Seen">
|
||||
<div class="date-cell">
|
||||
<span class="date-label">Initial</span>
|
||||
{{ new Date(row.first_seen).toLocaleString() }}
|
||||
</div>
|
||||
</td>
|
||||
<td data-label="Last Seen">
|
||||
<div class="date-cell">
|
||||
<span class="date-label">Most Recent</span>
|
||||
{{ new Date(row.last_seen).toLocaleString() }}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@endeach
|
||||
@else
|
||||
<tr>
|
||||
<td colspan="3" style="text-align: center; padding: 40px; color: #666;">
|
||||
No IP history records found for this user.
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include(snippets/footer)
|
||||
@@ -68,6 +68,9 @@
|
||||
@endif
|
||||
|
||||
@if(u.id)
|
||||
@if(log_user_ips)
|
||||
<a href="/admin/user/{{ u.id }}/ips" class="btn-modern" style="background: rgba(150, 150, 150, 0.1); color: #aaa; border: 1px solid rgba(150, 150, 150, 0.2); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; height: 32px; padding: 0 10px;" title="View IP History">IP Hist</a>
|
||||
@endif
|
||||
<button data-id="{{ u.id }}" data-name="{!! u.user !!}" data-username="{{ u.login }}" onclick="deleteUploads(this)" class="btn-modern btn-files">Del Files</button>
|
||||
<button data-id="{{ u.id }}" data-name="{!! u.user !!}" data-username="{{ u.login }}" onclick="deleteComments(this)" class="btn-modern btn-comms">Del Comms</button>
|
||||
<button data-id="{{ u.id }}" data-name="{!! u.user !!}" data-username="{{ u.login }}" onclick="adminBulkDeleteHalls(this)" class="btn-modern btn-comms" title="Delete all user halls" style="background: rgba(255, 0, 255, 0.1); color: #ff00ff; border: 1px solid rgba(255, 0, 255, 0.2);"><i class="fa fa-folder-open"></i> Del Halls</button>
|
||||
|
||||
@@ -537,6 +537,7 @@
|
||||
|
||||
@if(session)
|
||||
<script src="/s/js/upload.js?v={{ ts }}"></script>
|
||||
<script src="/s/js/f0ck_upload_init.js?v={{ ts }}"></script>
|
||||
<script src="/s/js/tag_autocomplete.js?v={{ ts }}"></script>
|
||||
<script src="/s/js/mention_autocomplete.js?v={{ ts }}"></script>
|
||||
<script src="/s/js/user.js?v={{ ts }}"></script>
|
||||
|
||||
@@ -375,7 +375,4 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/s/js/upload.js?v={{ ts }}"></script>
|
||||
<script src="/s/js/f0ck_upload_init.js?v={{ ts }}"></script>
|
||||
|
||||
@endif
|
||||
|
||||
Reference in New Issue
Block a user