优化邮件验证和密码重置链接

- 修改邮件中的验证和重置链接,直接指向 app.html 页面
- 在落地页添加容错脚本,自动重定向带 token 的请求到应用页
- 提升用户体验,减少跳转步骤

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-24 18:57:50 +08:00
parent cfbb134587
commit 104d7fe0ef
2 changed files with 13 additions and 3 deletions

View File

@@ -827,7 +827,7 @@ app.post('/api/register',
verification_expires_at: expiresAtMs
});
const verifyLink = `${getProtocol(req)}://${req.get('host')}/?verifyToken=${verifyToken}`;
const verifyLink = `${getProtocol(req)}://${req.get('host')}/app.html?verifyToken=${verifyToken}`;
try {
await sendMail(
@@ -894,7 +894,7 @@ app.post('/api/resend-verification', [
const expiresAtMs = Date.now() + 30 * 60 * 1000;
VerificationDB.setVerification(user.id, verifyToken, expiresAtMs);
const verifyLink = `${getProtocol(req)}://${req.get('host')}/?verifyToken=${verifyToken}`;
const verifyLink = `${getProtocol(req)}://${req.get('host')}/app.html?verifyToken=${verifyToken}`;
await sendMail(
user.email,
'邮箱验证 - 玩玩云',
@@ -959,7 +959,7 @@ app.post('/api/password/forgot', [
const expiresAtMs = Date.now() + 30 * 60 * 1000;
PasswordResetTokenDB.create(user.id, token, expiresAtMs);
const resetLink = `${getProtocol(req)}://${req.get('host')}/?resetToken=${token}`;
const resetLink = `${getProtocol(req)}://${req.get('host')}/app.html?resetToken=${token}`;
await sendMail(
email,
'密码重置 - 玩玩云',

View File

@@ -4,6 +4,16 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>玩玩云 - 现代化云存储管理平台</title>
<script>
// 邮件激活/重置链接容错如果在落地页携带token自动跳转到应用页处理
(function() {
const search = window.location.search;
if (!search) return;
if (search.includes('verifyToken') || search.includes('resetToken')) {
window.location.replace(`app.html${search}`);
}
})();
</script>
<link rel="stylesheet" href="libs/fontawesome/css/all.min.css">
<style>
* {