feat(app): add announcements, feedback, settings (stage 5)
This commit is contained in:
8
app.py
8
app.py
@@ -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
|
||||
|
||||
# 更新密码(使用管理员重置密码的函数,因为已经验证过当前密码了)
|
||||
|
||||
Reference in New Issue
Block a user