diff --git a/app.py b/app.py index 4fb1ca8..e83c4f6 100644 --- a/app.py +++ b/app.py @@ -861,6 +861,16 @@ def update_settings(): user.phone = phone user.phone_verified = False + # 通知邮箱(更换后邮件通知发送到此邮箱) + if 'email' in data: + email = data.get('email', '') + if email and '@' in email: + # 检查邮箱是否已被其他用户使用 + existing = User.query.filter(User.email == email, User.id != user.id).first() + if existing: + return jsonify({'error': '该邮箱已被其他用户使用'}), 400 + user.email = email + # 通知设置 if 'notify_on_complete' in data: user.notify_on_complete = data.get('notify_on_complete', True) diff --git a/templates/profile.html b/templates/profile.html index 0724237..841ddcb 100644 --- a/templates/profile.html +++ b/templates/profile.html @@ -186,20 +186,32 @@
-
📧 邮件通知
-
- - +
📧 通知邮箱
+
+ {% if user.email %} +

当前通知邮箱:{{ user.email }}

+ + {% else %} +

未设置通知邮箱

+ + {% endif %} + +
+ +
+ + +
+
+ + +
+ 通知将发送至上述邮箱
-
- - -
- 通知发送至:{{ user.email }}
@@ -334,6 +346,33 @@ + + + \ No newline at end of file