Files
pipeline-lifetime/templates/admin.html
T

66 lines
2.8 KiB
HTML

{% extends "base.html" %}
{% from "_pagination.html" import render_pagination %}
{% set active_page = "admin" %}
{% block title %}管理台{% endblock %}
{% block content %}
<div>
<h1 class="text-3xl font-extrabold">管理台</h1>
<p class="mt-2 text-sm text-textSub">管理注册状态、密码重置和所有预测记录。</p>
</div>
<section class="mt-6 rounded-xl border border-line bg-white p-5 shadow-panel">
<h2 class="font-extrabold">用户注册</h2>
<form method="post" action="{{ url_for('main.update_registration_setting') }}" class="mt-3 flex items-center gap-3">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<label class="text-sm">
<input type="checkbox" name="allow_registration" {{ 'checked' if registration_allowed }}>
允许自助注册
</label>
<button class="ui-btn ui-btn-sm ui-btn-primary">保存</button>
</form>
</section>
<section class="mt-6 rounded-xl border border-line bg-white p-5 shadow-panel">
<h2 class="font-extrabold">用户密码重置</h2>
<p class="mt-1 text-sm text-textSub">向用户已验证邮箱发送重置通知。</p>
<div class="mt-4 overflow-x-auto">
<table class="min-w-full text-sm">
<thead>
<tr class="border-b border-line text-left">
<th class="p-2">显示名</th><th class="p-2">邮箱</th><th class="p-2">操作</th>
</tr>
</thead>
<tbody>
{% for user in password_reset_users %}
<tr class="border-b border-line">
<td class="p-2">{{ user.username }}</td>
<td class="p-2">{{ user.email or '未设置' }}</td>
<td class="p-2">
{% if user.email %}
<form method="post" action="{{ url_for('main.admin_password_reset', user_id=user.id) }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button class="ui-btn ui-btn-sm ui-btn-secondary">发送重置通知</button>
</form>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</section>
<section class="mt-6 rounded-xl border border-line bg-white p-5 shadow-panel">
<h2 class="font-extrabold">上传记录</h2>
<div class="mt-4 overflow-x-auto">
<table class="min-w-full text-sm">
<thead><tr class="border-b border-line text-left"><th class="p-2">用户</th><th class="p-2">文件</th><th class="p-2">时间</th></tr></thead>
<tbody>{% for record in records %}<tr class="border-b border-line"><td class="p-2">{{ record.user.username }}</td><td class="p-2">{{ record.original_filename }}</td><td class="p-2">{{ format_datetime(record.upload_time) }}</td></tr>{% endfor %}</tbody>
</table>
</div>
{{ render_pagination(pagination, 'main.admin_dashboard') }}
</section>
{% endblock %}