From 6fbcf2c81b7a795e4dbfc2a43d9dde946dc216c4 Mon Sep 17 00:00:00 2001
From: stardrophere <1925008984@qq.com>
Date: Thu, 12 Mar 2026 19:38:14 +0800
Subject: [PATCH] =?UTF-8?q?=E7=95=8C=E9=9D=A2=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
backend/app/api/endpoints/auth.py | 16 ++--
backend/app/utils/email_utils.py | 2 +-
frontend/src/views/DashboardView.vue | 2 +-
frontend/src/views/LoginView.vue | 123 +++++++++++++++++++++++++--
frontend/src/views/RegisterView.vue | 123 +++++++++++++++++++++++++--
5 files changed, 244 insertions(+), 22 deletions(-)
diff --git a/backend/app/api/endpoints/auth.py b/backend/app/api/endpoints/auth.py
index 0ed2ba3..01e7120 100644
--- a/backend/app/api/endpoints/auth.py
+++ b/backend/app/api/endpoints/auth.py
@@ -5,7 +5,7 @@ from typing import Tuple
from fastapi import APIRouter, Depends, HTTPException, status
from sqlalchemy.orm import Session
-
+import random
from app.api.dependencies import get_db
from app.core.security import (
create_access_token,
@@ -52,10 +52,10 @@ def _normalize_email(email: str) -> str:
def _build_verification_email(code: str, purpose_text: str, expire_minutes: int) -> str:
return f"""
-
InsightRadar Email Verification
-
Your {purpose_text} verification code is:
+
InsightRadar 邮箱验证
+
您的{purpose_text}验证码是:
{code}
-
The code is valid for {expire_minutes} minutes. Do not share it with others.
+
该验证码在 {expire_minutes} 分钟内有效。请勿泄露给他人。
"""
@@ -152,8 +152,8 @@ async def send_register_code(payload: RegisterCodeSendRequest, db: Session = Dep
email_sent = await send_html_email(
to_email=email,
- subject="InsightRadar Registration Code",
- html_content=_build_verification_email(code, "registration", REGISTER_CODE_EXPIRE_MINUTES),
+ subject=f"【{code}】InsightRadar 注册验证码",
+ html_content=_build_verification_email(code, "注册", REGISTER_CODE_EXPIRE_MINUTES),
)
if not email_sent:
code_record.is_used = True
@@ -186,8 +186,8 @@ async def send_login_code(payload: LoginCodeSendRequest, db: Session = Depends(g
email_sent = await send_html_email(
to_email=email,
- subject="InsightRadar Login Code",
- html_content=_build_verification_email(code, "login", LOGIN_CODE_EXPIRE_MINUTES),
+ subject=f"【{code}】InsightRadar 登录验证码",
+ html_content=_build_verification_email(code, "登录", LOGIN_CODE_EXPIRE_MINUTES),
)
if not email_sent:
code_record.is_used = True
diff --git a/backend/app/utils/email_utils.py b/backend/app/utils/email_utils.py
index 0dd94a2..5e0a9b7 100644
--- a/backend/app/utils/email_utils.py
+++ b/backend/app/utils/email_utils.py
@@ -17,7 +17,7 @@ async def send_html_email(
to_email: str,
subject: str,
html_content: str,
- sender_name: str = "AI 新闻",
+ sender_name: str = "AI 热点",
sender_email: str = None
) -> bool:
"""底层纯异步发送邮件工具"""
diff --git a/frontend/src/views/DashboardView.vue b/frontend/src/views/DashboardView.vue
index c7c2e74..d8557f6 100644
--- a/frontend/src/views/DashboardView.vue
+++ b/frontend/src/views/DashboardView.vue
@@ -817,7 +817,7 @@ watch(() => route.query.event, (newId) => {