docs & ui: 完善 captcha/aibox 文档,登录注册改为邮箱制

- captcha/README.md: 补充字段级接口文档与错误码表
- aibox/README.md: 对照 main.py 源码核对修正(入口/模型/工具/配置)
- static/public/login.html & register.html: 用户名改为邮箱
- static/public/js/register.js: 合并注册页双邮箱框为单一邮箱字段
This commit is contained in:
qing committed 2026-07-27 22:51:57 +08:00
1 parent f601efdd3f
commit ee44e1bef1
5 files changed
+293 -263

No files matched your search

+2 -19
View File
@@ -1,11 +1,9 @@
const form = document.getElementById('form');
const usernameInput = document.getElementById('regusername');
const emailInput = document.getElementById('regemail');
const codeInput = document.getElementById('code');
const getCodeButton = document.getElementById('getCode');
const passwordInput = document.getElementById('regpsw');
const repeatPasswordInput = document.getElementById('repwd');
const msgTip = document.getElementById('msgTip');
const emlTip = document.getElementById('emlTip');
const pwdTip = document.getElementById('pwdTip');
const codeTip = document.getElementById('codeTip');
@@ -21,27 +19,16 @@ form.addEventListener('reset', function () {
});
function clearTipStyle() {
msgTip.innerHTML = '';
emlTip.innerHTML = '';
pwdTip.innerHTML = '';
codeTip.innerHTML = '';
msgTip.classList.remove('tip-red', 'tip-yellow', 'tip-green');
emlTip.classList.remove('tip-red', 'tip-yellow', 'tip-green');
pwdTip.classList.remove('tip-red', 'tip-yellow', 'tip-green');
codeTip.classList.remove('tip-red', 'tip-yellow', 'tip-green');
}
clearTipStyle();
function checkUsername() {
const result = FormValidators.username(usernameInput.value);
msgTip.innerHTML = '';
msgTip.classList.remove('tip-red', 'tip-yellow', 'tip-green');
msgTip.textContent = result.message;
msgTip.classList.add(result.className);
return result.valid ? result.value : false;
}
function checkEmail() {
const result = FormValidators.email(emailInput.value);
emlTip.innerHTML = '';
@@ -103,15 +90,12 @@ function checkCode() {
return code;
}
usernameInput.addEventListener('focus', checkUsername);
passwordInput.addEventListener('focus', checkPassword);
repeatPasswordInput.addEventListener('focus', checkPassword);
usernameInput.addEventListener('input', checkUsername);
passwordInput.addEventListener('input', checkPassword);
repeatPasswordInput.addEventListener('input', checkPassword);
usernameInput.addEventListener('blur', checkUsername);
passwordInput.addEventListener('blur', checkPassword);
repeatPasswordInput.addEventListener('blur', checkPassword);
@@ -146,16 +130,15 @@ getCodeButton.addEventListener('click', function () {
form.addEventListener('submit', async function (e) {
e.preventDefault();
const username = checkUsername();
const email = checkEmail();
const password = checkPassword();
const code = checkCode();
if (!username || !email || !password || !code) {
if (!email || !password || !code) {
return;
}
const jsonBody = JSON.stringify({
username,
username: email,
password
});
+2 -2
View File
@@ -11,8 +11,8 @@
<h2>用户登录</h2>
<form id="form" novalidate>
<div>
<label>用户名/推荐邮箱:</label>
<input type="text" id="loginUsername" placeholder="请输入用户名">
<label>邮箱:</label>
<input type="text" id="loginUsername" placeholder="请输入邮箱">
<span id="msgTip"></span>
<label>密码:</label>
<input type="password" id="loginPassword" placeholder="请输入密码">
+1 -4
View File
@@ -11,10 +11,7 @@
<h2>注册页面</h2>
<form id="form">
<div>
<label>用户名/推荐邮箱:</label>
<input type="text" id="regusername" placeholder="请输入用户名">
<span id="msgTip" ></span>
<label>邮箱号:</label>
<label>邮箱号:</label>
<input type="email" id="regemail" placeholder="请输入邮箱号">
<div class="code-box">验证码:
<input type="text" id="code" placeholder="请输入6位验证码" inputmode="numeric" maxlength="6">