Initial commit
This commit is contained in:
31
templates/accounts/login.html
Normal file
31
templates/accounts/login.html
Normal file
@@ -0,0 +1,31 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block title %}登录{% endblock %}
|
||||
{% block content %}
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-6">
|
||||
<h3 class="mb-3">登录</h3>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<div class="mb-3">
|
||||
<label class="form-label">用户名或邮箱</label>
|
||||
{{ form.login }}
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">密码</label>
|
||||
{{ form.password }}
|
||||
</div>
|
||||
{% if captcha_question %}
|
||||
<div class="mb-3">
|
||||
<label class="form-label">验证码:<span class="text-primary">{{ captcha_question }}</span></label>
|
||||
{{ form.captcha }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="d-flex gap-2">
|
||||
<button class="btn btn-primary" type="submit">登录</button>
|
||||
<a class="btn btn-outline-secondary" href="{% url 'accounts:register' %}">注册</a>
|
||||
<a class="btn btn-outline-info" href="{% url 'accounts:password_change' %}">修改密码</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
20
templates/accounts/login_history.html
Normal file
20
templates/accounts/login_history.html
Normal file
@@ -0,0 +1,20 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block title %}登录历史{% endblock %}
|
||||
{% block content %}
|
||||
<h3 class="mb-3">最近登录历史</h3>
|
||||
<table class="table table-striped">
|
||||
<thead><tr><th>时间</th><th>IP</th><th>User-Agent</th></tr></thead>
|
||||
<tbody>
|
||||
{% for r in records %}
|
||||
<tr>
|
||||
<td>{{ r.created_at }}</td>
|
||||
<td>{{ r.ip_address|default:"-" }}</td>
|
||||
<td>{{ r.user_agent }}</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr><td colspan="3" class="text-muted">暂无记录</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<a class="btn btn-outline-secondary" href="{% url 'accounts:profile' %}">返回用户中心</a>
|
||||
{% endblock %}
|
||||
26
templates/accounts/password_change.html
Normal file
26
templates/accounts/password_change.html
Normal file
@@ -0,0 +1,26 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block title %}修改密码{% endblock %}
|
||||
{% block content %}
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-6">
|
||||
<h3 class="mb-3">修改密码</h3>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<div class="mb-3">
|
||||
<label class="form-label">当前密码</label>
|
||||
{{ form.old_password }}
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">新密码</label>
|
||||
{{ form.new_password1 }}
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">确认新密码</label>
|
||||
{{ form.new_password2 }}
|
||||
</div>
|
||||
<button class="btn btn-primary" type="submit">保存</button>
|
||||
<a class="btn btn-outline-secondary ms-2" href="{% url 'accounts:profile' %}">返回用户中心</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
40
templates/accounts/profile.html
Normal file
40
templates/accounts/profile.html
Normal file
@@ -0,0 +1,40 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block title %}用户中心{% endblock %}
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h4 class="mb-3">资料维护</h4>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<div class="mb-3">
|
||||
<label class="form-label">显示名称</label>
|
||||
{{ form.display_name }}
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">联系电话</label>
|
||||
{{ form.contact_phone }}
|
||||
</div>
|
||||
<button class="btn btn-primary" type="submit">保存</button>
|
||||
<a class="btn btn-outline-info ms-2" href="{% url 'accounts:password_change' %}">修改密码</a>
|
||||
<a class="btn btn-outline-secondary ms-2" href="{% url 'accounts:login_history' %}">登录历史</a>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<h4 class="mb-3">最近登录记录</h4>
|
||||
<table class="table table-sm">
|
||||
<thead><tr><th>时间</th><th>IP</th><th>User-Agent</th></tr></thead>
|
||||
<tbody>
|
||||
{% for r in records %}
|
||||
<tr>
|
||||
<td>{{ r.created_at }}</td>
|
||||
<td>{{ r.ip_address|default:"-" }}</td>
|
||||
<td>{{ r.user_agent }}</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr><td colspan="3" class="text-muted">暂无登录记录</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
48
templates/accounts/register.html
Normal file
48
templates/accounts/register.html
Normal file
@@ -0,0 +1,48 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block title %}注册{% endblock %}
|
||||
{% block content %}
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
<h3 class="mb-3">注册账号</h3>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<div class="row g-3">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">用户名</label>
|
||||
{{ form.username }}
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">邮箱</label>
|
||||
{{ form.email }}
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">密码</label>
|
||||
{{ form.password1 }}
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">确认密码</label>
|
||||
{{ form.password2 }}
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">显示名称</label>
|
||||
{{ form.display_name }}
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">联系电话</label>
|
||||
{{ form.contact_phone }}
|
||||
</div>
|
||||
{% if captcha_question %}
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">验证码:<span class="text-primary">{{ captcha_question }}</span></label>
|
||||
{{ form.captcha }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="mt-3">
|
||||
<button class="btn btn-success" type="submit">注册</button>
|
||||
<a class="btn btn-outline-secondary" href="{% url 'accounts:login' %}">已有账号?去登录</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user