fixed some timezone log issues for auth
This commit is contained in:
@@ -520,7 +520,8 @@ def get_latest_auth_logs(reply_type=None, limit=5, time_range=None, offset=0):
|
||||
print(f"Warning: Unknown timezone '{tz_str}', falling back to UTC.")
|
||||
app_tz = pytz.utc
|
||||
now = datetime.now(app_tz)
|
||||
|
||||
print(f"🕒 Using timezone: {tz_str} → Now: {now.isoformat()}")
|
||||
|
||||
query_base = "SELECT * FROM auth_logs"
|
||||
filters = []
|
||||
params = []
|
||||
@@ -548,6 +549,7 @@ def get_latest_auth_logs(reply_type=None, limit=5, time_range=None, offset=0):
|
||||
|
||||
if delta:
|
||||
time_filter_dt = now - delta
|
||||
print(f"🕒 Filtering logs after: {time_filter_dt.isoformat()}")
|
||||
filters.append("timestamp >= %s")
|
||||
params.append(time_filter_dt)
|
||||
|
||||
@@ -575,7 +577,8 @@ def count_auth_logs(reply_type=None, time_range=None):
|
||||
print(f"Warning: Unknown timezone '{tz_str}', falling back to UTC.")
|
||||
app_tz = pytz.utc
|
||||
now = datetime.now(app_tz)
|
||||
|
||||
print(f"🕒 Using timezone: {tz_str} → Now: {now.isoformat()}")
|
||||
|
||||
query_base = "SELECT COUNT(*) FROM auth_logs"
|
||||
filters = []
|
||||
params = []
|
||||
@@ -603,6 +606,7 @@ def count_auth_logs(reply_type=None, time_range=None):
|
||||
|
||||
if delta:
|
||||
time_filter_dt = now - delta
|
||||
print(f"🕒 Filtering logs after: {time_filter_dt.isoformat()}")
|
||||
filters.append("timestamp >= %s")
|
||||
params.append(time_filter_dt)
|
||||
|
||||
|
||||
@@ -31,40 +31,37 @@
|
||||
<tr>
|
||||
<td>{{ entry.mac_address }}</td>
|
||||
|
||||
<td>
|
||||
<form method="POST" action="{{ url_for('user.update_description_route') }}">
|
||||
<!-- Form spans Description and Actions columns -->
|
||||
<form method="POST" action="{{ url_for('user.update_description_route') }}">
|
||||
<td>
|
||||
<input type="hidden" name="mac_address" value="{{ entry.mac_address }}">
|
||||
<input type="text" name="description" value="{{ entry.description or '' }}">
|
||||
</form>
|
||||
</td>
|
||||
</td>
|
||||
|
||||
<td>{{ entry.vendor or "..." }}</td>
|
||||
<td>{{ entry.vendor or "..." }}</td>
|
||||
|
||||
<td>
|
||||
<form method="POST" action="{{ url_for('user.update_vlan_route') }}" class="inline-form">
|
||||
<input type="hidden" name="mac_address" value="{{ entry.mac_address }}">
|
||||
<select name="group_id" onchange="this.form.submit()">
|
||||
{% for group in available_groups %}
|
||||
<option value="{{ group.vlan_id }}" {% if group.vlan_id == entry.vlan_id %}selected{% endif %}>
|
||||
VLAN {{ group.vlan_id }}{% if group.description %} - {{ group.description }}{% endif %}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</form>
|
||||
</td>
|
||||
<td>
|
||||
<form method="POST" action="{{ url_for('user.update_vlan_route') }}" class="inline-form">
|
||||
<input type="hidden" name="mac_address" value="{{ entry.mac_address }}">
|
||||
<select name="group_id" onchange="this.form.submit()">
|
||||
{% for group in available_groups %}
|
||||
<option value="{{ group.vlan_id }}" {% if group.vlan_id == entry.vlan_id %}selected{% endif %}>
|
||||
VLAN {{ group.vlan_id }}{% if group.description %} - {{ group.description }}{% endif %}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</form>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<form method="POST" action="{{ url_for('user.update_description_route') }}" style="display:inline;">
|
||||
<input type="hidden" name="mac_address" value="{{ entry.mac_address }}">
|
||||
<input type="hidden" name="description" value="{{ entry.description }}">
|
||||
<td>
|
||||
<button type="submit" title="Save">💾</button>
|
||||
</form>
|
||||
</form> <!-- Closing the description form here -->
|
||||
|
||||
<form method="POST" action="{{ url_for('user.delete') }}" style="display:inline;">
|
||||
<input type="hidden" name="mac_address" value="{{ entry.mac_address }}">
|
||||
<button type="submit" onclick="return confirm('Delete this MAC address?')">❌</button>
|
||||
</form>
|
||||
</td>
|
||||
<form method="POST" action="{{ url_for('user.delete') }}" style="display:inline;">
|
||||
<input type="hidden" name="mac_address" value="{{ entry.mac_address }}">
|
||||
<button type="submit" onclick="return confirm('Delete this MAC address?')">❌</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user