Dev qing #19

Merged
qing merged 74 commits from dev_qing into main 2026-08-05 12:31:42 +08:00
Showing only changes of commit 4749e58eeb - Show all commits
+16 -15
View File
@@ -309,21 +309,22 @@ def api_hash():
return jsonify({"hash": h})
@app.route('/api/reset_password', methods=['POST'])
def api_reset_password():
from flask import request, jsonify
import sqlite3 as _sql
data = request.get_json(force=True)
email = data.get('email', '').strip()
new_hash = data.get('password_hash', '').strip()
if not email or not new_hash:
return jsonify({"success": False, "error": "missing params"}), 400
conn = _sql.connect(GATEWAY_DB)
conn.execute("UPDATE Users SET password_hash=? WHERE email=?", (new_hash, email))
conn.commit()
conn.close()
logs.info("static", "密码重置", extra={"email": email[:3] + "***"})
return jsonify({"success": True})
# DISABLED: P0 security issue - no authentication, allows arbitrary password reset
# @app.route('/api/reset_password', methods=['POST'])
# def api_reset_password():
# from flask import request, jsonify
# import sqlite3 as _sql
# data = request.get_json(force=True)
# email = data.get('email', '').strip()
# new_hash = data.get('password_hash', '').strip()
# if not email or not new_hash:
# return jsonify({"success": False, "error": "missing params"}), 400
# conn = _sql.connect(GATEWAY_DB)
# conn.execute("UPDATE Users SET password_hash=? WHERE email=?", (new_hash, email))
# conn.commit()
# conn.close()
# logs.info("static", "密码重置", extra={"email": email[:3] + "***"})
# return jsonify({"success": True})
@app.route('/api/check_user', methods=['POST'])