mirror of
https://github.com/tmdinosaurcenter/kiosk-guestbook.git
synced 2026-06-04 00:17:44 -06:00
fix: add logout button to admin pages
This commit is contained in:
@@ -284,6 +284,15 @@ def admin_delete(entry_id):
|
|||||||
logger.error("Database error deleting guest %d: %s", entry_id, e)
|
logger.error("Database error deleting guest %d: %s", entry_id, e)
|
||||||
return redirect(url_for('admin', page=request.args.get('page', 1)))
|
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')
|
@app.route('/admin/users')
|
||||||
@require_superadmin
|
@require_superadmin
|
||||||
def admin_users():
|
def admin_users():
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
{% if current_role == 'superadmin' %}
|
{% if current_role == 'superadmin' %}
|
||||||
<a href="{{ url_for('admin_users') }}" class="btn btn-outline-secondary btn-sm">Manage Users</a>
|
<a href="{{ url_for('admin_users') }}" class="btn btn-outline-secondary btn-sm">Manage Users</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<a href="{{ url_for('admin_logout') }}" class="btn btn-outline-danger btn-sm">Logout</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,10 @@
|
|||||||
<div class="container py-4" style="max-width: 700px;">
|
<div class="container py-4" style="max-width: 700px;">
|
||||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||||
<h1 class="h3 mb-0">User Management</h1>
|
<h1 class="h3 mb-0">User Management</h1>
|
||||||
|
<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') }}" 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>
|
||||||
|
|
||||||
<div class="card mb-4">
|
<div class="card mb-4">
|
||||||
|
|||||||
Reference in New Issue
Block a user