Files
WeReadBoard/templates/login.html
T

50 lines
2.8 KiB
HTML

<!doctype html>
<html lang="zh-CN" data-theme="light">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>登录 · 阅间</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/styles.css') }}">
</head>
<body class="login-page">
<main class="login-shell">
<div class="logo login-logo">
<div class="logo-mark"><svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M4 4c4-1 6 0 8 2 2-2 4-3 8-2v15c-4-1-6 0-8 2-2-2-4-3-8-2zM12 6v15" fill="none" stroke="currentColor"
stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" />
</svg></div>
<div>阅间<small>READING SPACE</small></div>
</div>
<section class="login-panel card">
<div class="eyebrow">YOUR READING SPACE</div>
<h1>{{ '服务暂不可用' if unavailable else ('首次设置' if not initialized else '欢迎回来') }}</h1>
<p>{{ '请检查服务配置或数据库连接。' if unavailable else ('创建管理员账号以启用访问保护。' if not initialized else '登录后继续你的阅读旅程。') }}</p>
{% if error %}<div class="login-error" role="alert">{{ error }}</div>{% endif %}
{% if not unavailable and not initialized %}
{% if not setup_enabled %}<div class="login-error" role="alert">尚未配置一次性初始化口令,请联系管理员。</div>{% endif %}
<form method="post" action="{{ url_for('auth.initialize_account') }}" class="login-form">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<label>一次性初始化口令<input name="setup_token" type="password" autocomplete="off" required autofocus></label>
<label>管理员账号<input name="username" maxlength="64" autocomplete="username" required></label>
<label>设置密码<input name="password" type="password" minlength="12" maxlength="256" autocomplete="new-password"
required></label>
<button class="primary" type="submit" {% if not setup_enabled %}disabled{% endif %}>创建账号并进入</button>
</form>
{% elif not unavailable %}
<form method="post" action="{{ url_for('auth.login') }}" class="login-form">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<label>账号<input name="username" maxlength="64" autocomplete="username" required autofocus></label>
<label>密码<input name="password" type="password" autocomplete="current-password" required></label>
<button class="primary" type="submit">登录</button>
</form>
{% endif %}
</section>
<p class="login-foot">阅间 · 与好书相伴,与自己相遇 · 版本 {{ app_version }}</p>
</main>
</body>
</html>