feat: 添加邮件功能第五阶段 - 用户邮箱绑定
1. 添加邮箱绑定验证邮件模板 (templates/email/bind_email.html) 2. 在email_service.py中添加: - send_bind_email_verification() 发送绑定验证邮件 - verify_bind_email_token() 验证绑定Token 3. 在database.py中添加: - update_user_email() 更新用户邮箱 4. 在app.py中添加API: - GET /api/user/email - 获取用户邮箱信息 - POST /api/user/bind-email - 发送绑定验证邮件 - GET /api/verify-bind-email/<token> - 验证绑定Token - POST /api/user/unbind-email - 解绑邮箱 5. 更新templates/index.html: - 将"修改密码"弹窗改为"个人设置" - 添加邮箱绑定/解绑功能UI - 显示邮箱状态(未绑定/待验证/已验证) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
80
templates/email/bind_email.html
Normal file
80
templates/email/bind_email.html
Normal file
@@ -0,0 +1,80 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
</head>
|
||||
<body style="margin: 0; padding: 0; font-family: 'Microsoft YaHei', Arial, sans-serif; background-color: #f5f5f5;">
|
||||
<table width="100%" cellpadding="0" cellspacing="0" style="background-color: #f5f5f5; padding: 30px 0;">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<table width="600" cellpadding="0" cellspacing="0" style="background-color: #ffffff; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.1);">
|
||||
<!-- 头部 -->
|
||||
<tr>
|
||||
<td style="background: linear-gradient(135deg, #3498db 0%, #2980b9 100%); padding: 30px; border-radius: 10px 10px 0 0; text-align: center;">
|
||||
<h1 style="color: #ffffff; margin: 0; font-size: 24px;">知识管理平台</h1>
|
||||
<p style="color: rgba(255,255,255,0.9); margin: 10px 0 0 0; font-size: 14px;">邮箱绑定验证</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- 内容 -->
|
||||
<tr>
|
||||
<td style="padding: 40px 30px;">
|
||||
<p style="color: #333; font-size: 16px; margin: 0 0 20px 0;">
|
||||
您好,<strong>{{ username }}</strong>!
|
||||
</p>
|
||||
<p style="color: #666; font-size: 14px; line-height: 1.8; margin: 0 0 25px 0;">
|
||||
您正在绑定此邮箱到您的账号。请点击下方按钮完成验证:
|
||||
</p>
|
||||
|
||||
<!-- 验证按钮 -->
|
||||
<table width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td align="center" style="padding: 20px 0;">
|
||||
<a href="{{ verify_url }}" style="display: inline-block; background: linear-gradient(135deg, #3498db 0%, #2980b9 100%); color: #ffffff; text-decoration: none; padding: 15px 40px; border-radius: 30px; font-size: 16px; font-weight: bold; box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);">
|
||||
验证邮箱
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- 链接备用 -->
|
||||
<div style="background: #f8f9fa; border-radius: 8px; padding: 15px; margin: 25px 0;">
|
||||
<p style="color: #666; font-size: 12px; margin: 0 0 10px 0;">
|
||||
如果按钮无法点击,请复制以下链接到浏览器打开:
|
||||
</p>
|
||||
<p style="color: #3498db; font-size: 12px; word-break: break-all; margin: 0;">
|
||||
{{ verify_url }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- 安全提示 -->
|
||||
<div style="background: #fff3cd; border-left: 4px solid #ffc107; padding: 15px; margin: 25px 0; border-radius: 0 5px 5px 0;">
|
||||
<p style="color: #856404; font-size: 13px; margin: 0;">
|
||||
<strong>安全提示:</strong>此链接1小时内有效。如果这不是您的操作,请忽略此邮件。
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<p style="color: #999; font-size: 13px; margin: 20px 0 0 0;">
|
||||
绑定成功后,您将可以通过此邮箱接收任务完成通知。
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- 底部 -->
|
||||
<tr>
|
||||
<td style="background: #f8f9fa; padding: 20px 30px; border-radius: 0 0 10px 10px; text-align: center;">
|
||||
<p style="color: #999; font-size: 12px; margin: 0;">
|
||||
此邮件由系统自动发送,请勿直接回复。
|
||||
</p>
|
||||
<p style="color: #ccc; font-size: 11px; margin: 10px 0 0 0;">
|
||||
© 知识管理平台
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user