feat: add secure invitation and reset links
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}接受注册邀请{% endblock %}
|
||||
{% block content %}
|
||||
<section class="mx-auto max-w-md rounded-xl border border-line bg-white p-5 shadow-panel sm:p-6">
|
||||
<span class="material-symbols-outlined text-4xl text-primary" aria-hidden="true">mail</span>
|
||||
<h1 class="mt-3 text-2xl font-extrabold">接受注册邀请</h1>
|
||||
<p class="mt-2 text-sm leading-6 text-textSub">受邀邮箱:{{ email }}。请设置显示名和登录密码以激活账号。</p>
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% for category, message in messages %}
|
||||
<p class="mt-4 rounded-lg p-3 text-sm {{ 'bg-dangerSoft text-dangerText' if category == 'error' else 'bg-blueSoft text-primaryDeep' }}">{{ message }}</p>
|
||||
{% endfor %}
|
||||
{% endwith %}
|
||||
<form method="post" class="mt-5 space-y-4" novalidate>
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||
<label class="block text-sm font-semibold">显示名<input name="username" required maxlength="100" autocomplete="username" class="mt-2 w-full rounded-lg border border-line px-3 py-2" placeholder="请输入显示名"></label>
|
||||
<label class="block text-sm font-semibold">设置密码<input name="password" type="password" required minlength="12" autocomplete="new-password" class="mt-2 w-full rounded-lg border border-line px-3 py-2" placeholder="12 位以上,包含大小写、数字和特殊字符"></label>
|
||||
<label class="block text-sm font-semibold">确认密码<input name="password_confirm" type="password" required minlength="12" autocomplete="new-password" class="mt-2 w-full rounded-lg border border-line px-3 py-2" placeholder="再次输入密码"></label>
|
||||
<button class="ui-btn ui-btn-primary w-full">完成注册</button>
|
||||
</form>
|
||||
</section>
|
||||
{% endblock %}
|
||||
@@ -22,6 +22,17 @@
|
||||
</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>
|
||||
<form method="post" action="{{ url_for('main.admin_send_registration_invitation') }}" class="mt-4 flex flex-col gap-2 sm:flex-row" novalidate>
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||
<label class="sr-only" for="inviteEmail">受邀邮箱</label>
|
||||
<input id="inviteEmail" name="email" type="email" required autocomplete="email" class="min-w-0 flex-1 rounded-lg border border-line px-3 py-2 text-sm" placeholder="受邀人的邮箱地址">
|
||||
<button class="ui-btn ui-btn-sm ui-btn-primary shrink-0">发送注册链接</button>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<section class="mt-6 rounded-xl border border-line bg-white p-5 shadow-panel">
|
||||
<div class="flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between">
|
||||
<div>
|
||||
|
||||
@@ -1 +1,23 @@
|
||||
{% extends "base.html" %}{% block content %}<section class="mx-auto max-w-md rounded-xl border border-line bg-white p-5 shadow-panel sm:p-6"><h1 class="text-2xl font-extrabold">找回密码</h1><p class="mt-2 text-sm text-textSub">输入邮箱后,如账户存在会收到验证码。</p><form method="post" class="mt-5 space-y-4"><input type="hidden" name="csrf_token" value="{{ csrf_token() }}"><input name="email" type="email" required class="w-full rounded-lg border border-line px-3 py-2" placeholder="邮箱"><button class="ui-btn ui-btn-primary w-full">发送验证码</button></form></section>{% endblock %}
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}找回密码{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<section class="mx-auto max-w-md rounded-xl border border-line bg-white p-5 shadow-panel sm:p-6">
|
||||
<h1 class="text-2xl font-extrabold">找回密码</h1>
|
||||
<p class="mt-2 text-sm text-textSub">输入邮箱后,如账户存在会收到一次性重置链接。</p>
|
||||
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% for category, message in messages %}
|
||||
<p class="mt-4 rounded-lg p-3 text-sm {{ 'bg-dangerSoft text-dangerText' if category == 'error' else 'bg-blueSoft text-primaryDeep' }}">{{ message }}</p>
|
||||
{% endfor %}
|
||||
{% endwith %}
|
||||
|
||||
<form method="post" class="mt-5 space-y-4">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||
<label class="sr-only" for="resetEmail">登录邮箱</label>
|
||||
<input id="resetEmail" name="email" type="email" required autocomplete="email" class="w-full rounded-lg border border-line px-3 py-2" placeholder="登录邮箱">
|
||||
<button class="ui-btn ui-btn-primary w-full">发送重置链接</button>
|
||||
</form>
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}重置密码{% endblock %}
|
||||
{% block content %}
|
||||
<section class="mx-auto max-w-md rounded-xl border border-line bg-white p-5 shadow-panel sm:p-6">
|
||||
<span class="material-symbols-outlined text-4xl text-primary" aria-hidden="true">lock_reset</span>
|
||||
<h1 class="mt-3 text-2xl font-extrabold">设置新密码</h1>
|
||||
<p class="mt-2 text-sm leading-6 text-textSub">请设置新的登录密码。提交后,其他登录状态和受信设备将被撤销。</p>
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% for category, message in messages %}
|
||||
<p class="mt-4 rounded-lg p-3 text-sm {{ 'bg-dangerSoft text-dangerText' if category == 'error' else 'bg-blueSoft text-primaryDeep' }}">{{ message }}</p>
|
||||
{% endfor %}
|
||||
{% endwith %}
|
||||
<form method="post" class="mt-5 space-y-4" novalidate>
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||
<label class="block text-sm font-semibold">新密码<input name="password" type="password" required minlength="12" autocomplete="new-password" class="mt-2 w-full rounded-lg border border-line px-3 py-2" placeholder="12 位以上,包含大小写、数字和特殊字符"></label>
|
||||
<label class="block text-sm font-semibold">确认新密码<input name="password_confirm" type="password" required minlength="12" autocomplete="new-password" class="mt-2 w-full rounded-lg border border-line px-3 py-2" placeholder="再次输入新密码"></label>
|
||||
<button class="ui-btn ui-btn-primary w-full">保存新密码</button>
|
||||
</form>
|
||||
</section>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user