Update admin interface: enhance user management UI and fix admin.py logic

This commit is contained in:
2025-11-09 21:10:37 -08:00
parent 6c3ad7b18d
commit fbcf901c8d
2 changed files with 54 additions and 0 deletions

View File

@@ -1,6 +1,23 @@
{% extends 'base.html' %}
{% block content %}
<div class="h-full flex flex-col">
{% if session.get('password_reset_link') %}
<div class="bg-blue-50 border border-blue-200 text-blue-800 px-4 py-3 rounded-md mb-4">
<p class="font-medium">Please send an email to {{ session.get('reset_user_email') }}</p>
<p class="mt-1">
<strong>Be sure to include this password reset link:</strong>
<a href="{{ session.get('password_reset_link') }}"
class="text-blue-600 hover:text-blue-800 underline"
target="_blank">
{{ session.get('password_reset_link') }}
</a>
</p>
</div>
{% endif %}
{% if session.get('password_reset_link') %}
{% set _ = session.pop('password_reset_link', None) %}
{% set _ = session.pop('reset_user_email', None) %}
{% endif %}
<h1 class="text-xl font-semibold mb-4">Admin: User Management</h1>
<div class="overflow-scroll">
@@ -11,6 +28,7 @@
<th class="px-4 py-3">Enabled</th>
<th class="px-4 py-3">Admin</th>
<th class="px-4 py-3">Case Email</th>
<th class="px-4 py-3">Actions</th>
</tr>
</thead>
<tbody class="bg-slate-100 divide-y divide-slate-300">
@@ -32,6 +50,15 @@
{% endif %}
</td>
<td class="px-4 py-3 text-sm text-slate-800">{{ user.case_email }}</td>
<td class="px-4 py-3 text-sm text-slate-800">
<form method="POST" action="/admin/users/{{ user.uid }}/reset-password" style="display: inline;">
<button type="submit"
class="text-blue-600 hover:text-blue-800 text-sm font-medium underline"
onclick="return confirm('Are you sure you want to reset the password for {{ user.user_email }}? This will send a password reset email to their account.')">
Reset Password
</button>
</form>
</td>
</tr>
{% else %}
<tr>