fix: 个人中心邮箱显示逻辑优化
- 显示用户注册邮箱作为通知邮箱 - 支持更换通知邮箱(一次只能通知一个) - 添加更换邮箱模态框 - API接口检查邮箱是否已被其他用户使用
This commit is contained in:
10
app.py
10
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)
|
||||
|
||||
Reference in New Issue
Block a user