Dev qing #19

Merged
qing merged 74 commits from dev_qing into main 2026-08-05 12:31:42 +08:00
2 changed files with 10 additions and 8 deletions
Showing only changes of commit 37c50ed517 - Show all commits

No files matched your search

+5 -4
View File
@@ -63,11 +63,11 @@ let cooldownTimer = null; // 重发倒计时(与服务端 smtp 同邮箱 60s
let captchaToken = '';
let captchaLoading = false; // 防重复点击:加载中忽略再次触发
async function refreshCaptcha() {
async function refreshCaptcha(preserveInput) {
if (captchaLoading) return;
captchaLoading = true;
captchaToken = '';
captchaInput.value = ''; // 开始刷新时清空输入,避免用户误用旧验证码
if (!preserveInput) captchaInput.value = ''; // 默认清空输入;preserveInput=true 时保留(获取验证码后)
captchaImg.style.opacity = '0.5'; // 视觉提示:正在刷新
try {
const res = await fetch('/captcha/image', { cache: 'no-store' });
@@ -267,8 +267,9 @@ getCodeButton.addEventListener('click', async function () {
codeTip.classList.add('tip-red');
if (httpStatus === 429) startResendCooldown(60); // 命中冷却/限流,倒计时对齐
} finally {
// CAPTCHA Token 一次性消费,无论成败都刷新
refreshCaptcha();
// CAPTCHA Token 一次性消费,无论成败都刷新图形验证码;
// 刷新时保留已输入的图形验证码答案,避免误清空用户输入
refreshCaptcha(true);
if (!cooldownTimer) getCodeButton.disabled = false;
}
});
+5 -4
View File
@@ -19,11 +19,11 @@ let cooldownTimer = null; // 重发倒计时(与服务端同邮箱 60s 发送
let captchaToken = '';
let captchaLoading = false; // 防重复点击:加载中忽略再次触发
async function refreshCaptcha() {
async function refreshCaptcha(preserveInput) {
if (captchaLoading) return;
captchaLoading = true;
captchaToken = '';
captchaInput.value = ''; // 开始刷新时清空输入,避免用户误用旧验证码
if (!preserveInput) captchaInput.value = ''; // 默认清空输入;preserveInput=true 时保留(获取验证码后)
captchaImg.style.opacity = '0.5'; // 视觉提示:正在刷新
try {
const res = await fetch('/captcha/image', { cache: 'no-store' });
@@ -222,8 +222,9 @@ getCodeButton.addEventListener('click', async function () {
codeTip.classList.add('tip-red');
if (httpStatus === 429) startResendCooldown(60); // 命中冷却/限流,倒计时对齐
} finally {
// CAPTCHA Token 一次性消费,无论成败都刷新
refreshCaptcha();
// CAPTCHA Token 一次性消费,无论成败都刷新图形验证码;
// 刷新时保留已输入的图形验证码答案,避免误清空用户输入
refreshCaptcha(true);
if (!cooldownTimer) getCodeButton.disabled = false;
}
});