feat(app): add announcements, feedback, settings (stage 5)

This commit is contained in:
2025-12-14 00:27:05 +08:00
parent 54cf6fe538
commit 69443c2de6
20 changed files with 715 additions and 64 deletions

8
app.py
View File

@@ -3697,9 +3697,13 @@ def change_user_password():
if len(new_password) < 6:
return jsonify({"error": "新密码至少6位"}), 400
# 验证当前密码
# 验证当前密码(使用现有 bcrypt/SHA256 兼容逻辑)
user = database.get_user_by_id(current_user.id)
if not user or not check_password_hash(user['password_hash'], current_password):
if not user:
return jsonify({"error": "用户不存在"}), 404
username = user.get('username', '')
if not username or not database.verify_user(username, current_password):
return jsonify({"error": "当前密码错误"}), 400
# 更新密码(使用管理员重置密码的函数,因为已经验证过当前密码了)