fix: 修复邮箱绑定验证错误及多项改进

1. 修复email_verified字段缺失导致的500错误
2. 将邮件主题从"知识管理平台"改为"自动化学习"
3. 增大验证码字体(28->42)和图片尺寸(120x40->160x60)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-11 22:45:44 +08:00
parent 65e2414ede
commit 79cf3c2f30
4 changed files with 163 additions and 21 deletions

View File

@@ -100,7 +100,7 @@ def init_email_tables():
password TEXT DEFAULT '',
use_ssl INTEGER DEFAULT 1,
use_tls INTEGER DEFAULT 0,
sender_name TEXT DEFAULT '知识管理平台',
sender_name TEXT DEFAULT '自动化学习',
sender_email TEXT DEFAULT '',
daily_limit INTEGER DEFAULT 0,
daily_sent INTEGER DEFAULT 0,
@@ -411,7 +411,7 @@ def create_smtp_config(data: Dict[str, Any]) -> int:
password,
int(data.get('use_ssl', True)),
int(data.get('use_tls', False)),
data.get('sender_name', '知识管理平台'),
data.get('sender_name', '自动化学习'),
data.get('sender_email', ''),
data.get('daily_limit', 0)
))
@@ -829,7 +829,7 @@ def test_smtp_config(config_id: int, test_email: str) -> Dict[str, Any]:
sender.connect()
sender.send(
test_email,
'知识管理平台 - SMTP配置测试',
'自动化学习 - SMTP配置测试',
f'这是一封测试邮件。\n\n配置名称: {config["name"]}\nSMTP服务器: {config["host"]}:{config["port"]}\n\n如果您收到此邮件说明SMTP配置正确。',
None,
None
@@ -1211,7 +1211,7 @@ def send_register_verification_email(
text_body = f"""
您好,{username}
感谢您注册知识管理平台。请点击下面的链接验证您的邮箱地址:
感谢您注册自动化学习。请点击下面的链接验证您的邮箱地址:
{verify_url}
@@ -1223,7 +1223,7 @@ def send_register_verification_email(
# 发送邮件
result = send_email(
to_email=email,
subject='知识管理平台】邮箱验证',
subject='自动化学习】邮箱验证',
body=text_body,
html_body=html_body,
email_type=EMAIL_TYPE_REGISTER,
@@ -1355,7 +1355,7 @@ def send_password_reset_email(
# 发送邮件
result = send_email(
to_email=email,
subject='知识管理平台】密码重置',
subject='自动化学习】密码重置',
body=text_body,
html_body=html_body,
email_type=EMAIL_TYPE_RESET,
@@ -1515,7 +1515,7 @@ def send_bind_email_verification(
# 发送邮件
result = send_email(
to_email=email,
subject='知识管理平台】邮箱绑定验证',
subject='自动化学习】邮箱绑定验证',
body=text_body,
html_body=html_body,
email_type=EMAIL_TYPE_BIND,
@@ -1832,7 +1832,7 @@ def send_task_complete_email(
result = send_email(
to_email=email,
subject=f'知识管理平台】任务完成 - {account_name}',
subject=f'自动化学习】任务完成 - {account_name}',
body=text_body,
html_body=html_body,
email_type=EMAIL_TYPE_TASK_COMPLETE,
@@ -1851,7 +1851,7 @@ def send_task_complete_email(
attachment = [{'filename': screenshot_filename, 'data': screenshot_data}]
result2 = send_email(
to_email=email,
subject=f'知识管理平台】任务截图 - {account_name}',
subject=f'自动化学习】任务截图 - {account_name}',
body=f'这是 {account_name} 的任务截图。',
attachments=attachment,
email_type=EMAIL_TYPE_TASK_COMPLETE,
@@ -1898,7 +1898,7 @@ def send_task_complete_email(
result = send_email(
to_email=email,
subject=f'知识管理平台】任务完成 - {account_name}',
subject=f'自动化学习】任务完成 - {account_name}',
body=text_body,
html_body=html_body,
attachments=attachments,