首次完成数据库登录,注册验证。首次完成,migrate_manager.py迁移多个数据库
This commit is contained in:
@@ -0,0 +1,260 @@
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: "Segoe UI", "Microsoft YaHei", -apple-system, sans-serif;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: radial-gradient(ellipse at top, #1e293b 0%, #0f172a 65%);
|
||||
color: #e2e8f0;
|
||||
padding: 20px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
body::before {
|
||||
content: "";
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background-image:
|
||||
linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px);
|
||||
background-size: 32px 32px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.admin-card {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
width: 100%;
|
||||
max-width: 420px;
|
||||
background: rgba(15, 23, 42, 0.78);
|
||||
border: 1px solid rgba(148, 163, 184, 0.16);
|
||||
backdrop-filter: blur(10px);
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
|
||||
padding: 40px 36px 30px;
|
||||
}
|
||||
|
||||
.admin-header {
|
||||
text-align: center;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.shield-badge {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
margin: 0 auto 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 50%;
|
||||
background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
|
||||
box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
|
||||
}
|
||||
|
||||
.shield-badge svg {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
fill: #ffffff;
|
||||
}
|
||||
|
||||
.admin-header h1 {
|
||||
font-size: 22px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
.admin-header .subtitle {
|
||||
margin-top: 6px;
|
||||
font-size: 13px;
|
||||
color: #94a3b8;
|
||||
letter-spacing: 2px;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.form-group label {
|
||||
display: block;
|
||||
font-size: 13px;
|
||||
color: #94a3b8;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.input-wrap {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.input-wrap input {
|
||||
width: 100%;
|
||||
padding: 12px 44px 12px 14px;
|
||||
font-size: 15px;
|
||||
color: #f1f5f9;
|
||||
background: rgba(30, 41, 59, 0.85);
|
||||
border: 1px solid rgba(148, 163, 184, 0.25);
|
||||
border-radius: 8px;
|
||||
outline: none;
|
||||
transition: border-color 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
|
||||
.input-wrap input::placeholder {
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.input-wrap input:focus {
|
||||
border-color: #3b82f6;
|
||||
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
|
||||
}
|
||||
|
||||
.toggle-pwd {
|
||||
position: absolute;
|
||||
right: 6px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: transparent;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.toggle-pwd:hover {
|
||||
color: #cbd5e1;
|
||||
background: rgba(148, 163, 184, 0.12);
|
||||
}
|
||||
|
||||
.toggle-pwd svg {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
fill: currentColor;
|
||||
}
|
||||
|
||||
.capslock-hint {
|
||||
display: none;
|
||||
margin-top: 6px;
|
||||
font-size: 12px;
|
||||
color: #f59e0b;
|
||||
}
|
||||
|
||||
.capslock-hint.show {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.error-msg {
|
||||
display: none;
|
||||
background: rgba(220, 38, 38, 0.14);
|
||||
border: 1px solid rgba(220, 38, 38, 0.4);
|
||||
color: #fca5a5;
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
padding: 10px 12px;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.submit-btn {
|
||||
width: 100%;
|
||||
padding: 13px;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
letter-spacing: 4px;
|
||||
color: #ffffff;
|
||||
background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%);
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
transition: opacity 0.2s, transform 0.1s;
|
||||
}
|
||||
|
||||
.submit-btn:hover:not(:disabled) {
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.submit-btn:active:not(:disabled) {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
.submit-btn:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.demo-tip {
|
||||
margin-top: 22px;
|
||||
padding-top: 16px;
|
||||
border-top: 1px dashed rgba(148, 163, 184, 0.2);
|
||||
font-size: 12px;
|
||||
color: #64748b;
|
||||
text-align: center;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.success-panel {
|
||||
display: none;
|
||||
text-align: center;
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.success-panel .check-icon {
|
||||
width: 72px;
|
||||
height: 72px;
|
||||
margin: 0 auto 18px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 50%;
|
||||
background: rgba(34, 197, 94, 0.15);
|
||||
border: 2px solid rgba(34, 197, 94, 0.5);
|
||||
}
|
||||
|
||||
.success-panel .check-icon svg {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
stroke: #22c55e;
|
||||
stroke-width: 3;
|
||||
fill: none;
|
||||
}
|
||||
|
||||
.success-panel h2 {
|
||||
font-size: 20px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.success-panel p {
|
||||
font-size: 13px;
|
||||
color: #94a3b8;
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
.back-btn {
|
||||
margin-top: 24px;
|
||||
padding: 10px 28px;
|
||||
font-size: 14px;
|
||||
color: #cbd5e1;
|
||||
background: transparent;
|
||||
border: 1px solid rgba(148, 163, 184, 0.35);
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
|
||||
.back-btn:hover {
|
||||
background: rgba(148, 163, 184, 0.12);
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.admin-card {
|
||||
padding: 32px 22px 24px;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: "Segoe UI", "Microsoft YaHei", -apple-system, sans-serif;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.form-group label {
|
||||
display: block;
|
||||
font-size: 14px;
|
||||
color: #555;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.form-group input {
|
||||
width: 100%;
|
||||
padding: 12px 14px;
|
||||
font-size: 15px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 8px;
|
||||
outline: none;
|
||||
transition: border-color 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
|
||||
.form-group input:focus {
|
||||
border-color: #667eea;
|
||||
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
|
||||
}
|
||||
|
||||
.submit-btn {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
font-size: 16px;
|
||||
color: #fff;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
transition: opacity 0.2s, transform 0.1s;
|
||||
}
|
||||
|
||||
.submit-btn:hover {
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.submit-btn:active {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
.error-msg {
|
||||
display: none;
|
||||
background: #fdecea;
|
||||
color: #c0392b;
|
||||
font-size: 13px;
|
||||
padding: 10px 12px;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
.login-card {
|
||||
width: 100%;
|
||||
max-width: 400px;
|
||||
background: #ffffff;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
|
||||
padding: 40px 32px;
|
||||
}
|
||||
|
||||
.login-card h1 {
|
||||
text-align: center;
|
||||
font-size: 24px;
|
||||
color: #333;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.login-card .subtitle {
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
color: #888;
|
||||
margin-bottom: 28px;
|
||||
}
|
||||
|
||||
.form-options {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 13px;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.form-options label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
color: #555;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.form-options a {
|
||||
color: #667eea;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.form-options a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.register-link {
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
color: #888;
|
||||
margin-top: 24px;
|
||||
}
|
||||
|
||||
.register-link a {
|
||||
color: #667eea;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.register-link a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
.register-card {
|
||||
width: 100%;
|
||||
max-width: 400px;
|
||||
background: #ffffff;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
|
||||
padding: 40px 32px;
|
||||
}
|
||||
|
||||
.register-card h1 {
|
||||
text-align: center;
|
||||
font-size: 24px;
|
||||
color: #333;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.register-card .subtitle {
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
color: #888;
|
||||
margin-bottom: 28px;
|
||||
}
|
||||
|
||||
.form-group .hint {
|
||||
font-size: 12px;
|
||||
color: #aaa;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.agreement {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
font-size: 13px;
|
||||
color: #555;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.agreement input {
|
||||
margin-top: 3px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.agreement a {
|
||||
color: #667eea;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.agreement a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.login-link {
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
color: #888;
|
||||
margin-top: 24px;
|
||||
}
|
||||
|
||||
.login-link a {
|
||||
color: #667eea;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.login-link a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
var form = document.getElementById('adminLoginForm');
|
||||
var errorBox = document.getElementById('errorBox');
|
||||
var submitBtn = document.getElementById('submitBtn');
|
||||
var successPanel = document.getElementById('successPanel');
|
||||
var passwordInput = document.getElementById('password');
|
||||
|
||||
form.addEventListener('submit', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var username = document.getElementById('username').value.trim();
|
||||
var password = passwordInput.value;
|
||||
var errors = [];
|
||||
|
||||
if (!username) {
|
||||
errors.push('用户名不能为空');
|
||||
}
|
||||
if (!password) {
|
||||
errors.push('密码不能为空');
|
||||
} else if (password.length < 6) {
|
||||
errors.push('密码长度至少为 6 位');
|
||||
}
|
||||
|
||||
if (errors.length > 0) {
|
||||
errorBox.textContent = errors.join(';');
|
||||
errorBox.style.display = 'block';
|
||||
return;
|
||||
}
|
||||
|
||||
errorBox.style.display = 'none';
|
||||
submitBtn.disabled = true;
|
||||
submitBtn.textContent = '登录中…';
|
||||
|
||||
setTimeout(function () {
|
||||
form.style.display = 'none';
|
||||
document.getElementById('welcomeName').textContent = username;
|
||||
successPanel.style.display = 'block';
|
||||
submitBtn.disabled = false;
|
||||
submitBtn.textContent = '登 录';
|
||||
}, 900);
|
||||
});
|
||||
|
||||
document.getElementById('togglePwd').addEventListener('click', function () {
|
||||
var isHidden = passwordInput.type === 'password';
|
||||
passwordInput.type = isHidden ? 'text' : 'password';
|
||||
this.setAttribute('aria-label', isHidden ? '隐藏密码' : '显示密码');
|
||||
this.style.color = isHidden ? '#3b82f6' : '';
|
||||
});
|
||||
|
||||
function updateCapslockHint(e) {
|
||||
var hint = document.getElementById('capslockHint');
|
||||
var capsOn = e.getModifierState && e.getModifierState('CapsLock');
|
||||
hint.classList.toggle('show', !!capsOn);
|
||||
}
|
||||
passwordInput.addEventListener('keydown', updateCapslockHint);
|
||||
passwordInput.addEventListener('keyup', updateCapslockHint);
|
||||
|
||||
document.getElementById('backBtn').addEventListener('click', function () {
|
||||
successPanel.style.display = 'none';
|
||||
form.style.display = 'block';
|
||||
form.reset();
|
||||
document.getElementById('username').focus();
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
document.getElementById('loginForm').addEventListener('submit', function (e) {
|
||||
var errorBox = document.getElementById('errorBox');
|
||||
var username = document.getElementById('username').value.trim();
|
||||
var password = document.getElementById('password').value;
|
||||
var errors = [];
|
||||
|
||||
if (!username) {
|
||||
errors.push('用户名不能为空');
|
||||
}
|
||||
if (!password) {
|
||||
errors.push('密码不能为空');
|
||||
} else if (password.length < 6) {
|
||||
errors.push('密码长度至少为 6 位');
|
||||
}
|
||||
|
||||
if (errors.length > 0) {
|
||||
e.preventDefault();
|
||||
errorBox.textContent = errors.join(';');
|
||||
errorBox.style.display = 'block';
|
||||
} else {
|
||||
errorBox.style.display = 'none';
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,43 @@
|
||||
document.getElementById('registerForm').addEventListener('submit', function (e) {
|
||||
var errorBox = document.getElementById('errorBox');
|
||||
var username = document.getElementById('username').value.trim();
|
||||
var email = document.getElementById('email').value.trim();
|
||||
var password = document.getElementById('password').value;
|
||||
var confirmPassword = document.getElementById('confirmPassword').value;
|
||||
var agree = document.getElementById('agree').checked;
|
||||
var errors = [];
|
||||
|
||||
if (!username) {
|
||||
errors.push('用户名不能为空');
|
||||
} else if (username.length < 3 || username.length > 20) {
|
||||
errors.push('用户名长度需在 3-20 个字符之间');
|
||||
}
|
||||
|
||||
if (!email) {
|
||||
errors.push('邮箱不能为空');
|
||||
} else if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
|
||||
errors.push('邮箱格式不正确');
|
||||
}
|
||||
|
||||
if (!password) {
|
||||
errors.push('密码不能为空');
|
||||
} else if (password.length < 6) {
|
||||
errors.push('密码长度至少为 6 位');
|
||||
}
|
||||
|
||||
if (password !== confirmPassword) {
|
||||
errors.push('两次输入的密码不一致');
|
||||
}
|
||||
|
||||
if (!agree) {
|
||||
errors.push('请先阅读并同意服务条款和隐私政策');
|
||||
}
|
||||
|
||||
if (errors.length > 0) {
|
||||
e.preventDefault();
|
||||
errorBox.textContent = errors.join(';');
|
||||
errorBox.style.display = 'block';
|
||||
} else {
|
||||
errorBox.style.display = 'none';
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user