fix: add logout button to admin pages

This commit is contained in:
2026-03-10 10:39:10 -06:00
parent 4f0a7df22a
commit 94d6690e57
3 changed files with 14 additions and 1 deletions
+9
View File
@@ -284,6 +284,15 @@ def admin_delete(entry_id):
logger.error("Database error deleting guest %d: %s", entry_id, e)
return redirect(url_for('admin', page=request.args.get('page', 1)))
@app.route('/admin/logout')
def admin_logout():
return Response(
'<p style="font-family:sans-serif">You have been logged out. '
'<a href="/admin">Log in again</a></p>',
401,
{'WWW-Authenticate': 'Basic realm="Admin"', 'Content-Type': 'text/html'}
)
@app.route('/admin/users')
@require_superadmin
def admin_users():
+1
View File
@@ -15,6 +15,7 @@
{% if current_role == 'superadmin' %}
<a href="{{ url_for('admin_users') }}" class="btn btn-outline-secondary btn-sm">Manage Users</a>
{% endif %}
<a href="{{ url_for('admin_logout') }}" class="btn btn-outline-danger btn-sm">Logout</a>
</div>
</div>
+4 -1
View File
@@ -10,7 +10,10 @@
<div class="container py-4" style="max-width: 700px;">
<div class="d-flex justify-content-between align-items-center mb-4">
<h1 class="h3 mb-0">User Management</h1>
<a href="{{ url_for('admin') }}" class="btn btn-outline-secondary btn-sm">Back to Entries</a>
<div class="d-flex gap-2">
<a href="{{ url_for('admin') }}" class="btn btn-outline-secondary btn-sm">Back to Entries</a>
<a href="{{ url_for('admin_logout') }}" class="btn btn-outline-danger btn-sm">Logout</a>
</div>
</div>
<div class="card mb-4">