fix(static): 禁用无认证的 /api/reset_password 接口
This commit is contained in:
1 parent
5fbe3ed5e4
commit
4749e58eeb
1 file changed
+16
-15
+16
-15
@@ -309,21 +309,22 @@ def api_hash():
|
|||||||
return jsonify({"hash": h})
|
return jsonify({"hash": h})
|
||||||
|
|
||||||
|
|
||||||
@app.route('/api/reset_password', methods=['POST'])
|
# DISABLED: P0 security issue - no authentication, allows arbitrary password reset
|
||||||
def api_reset_password():
|
# @app.route('/api/reset_password', methods=['POST'])
|
||||||
from flask import request, jsonify
|
# def api_reset_password():
|
||||||
import sqlite3 as _sql
|
# from flask import request, jsonify
|
||||||
data = request.get_json(force=True)
|
# import sqlite3 as _sql
|
||||||
email = data.get('email', '').strip()
|
# data = request.get_json(force=True)
|
||||||
new_hash = data.get('password_hash', '').strip()
|
# email = data.get('email', '').strip()
|
||||||
if not email or not new_hash:
|
# new_hash = data.get('password_hash', '').strip()
|
||||||
return jsonify({"success": False, "error": "missing params"}), 400
|
# if not email or not new_hash:
|
||||||
conn = _sql.connect(GATEWAY_DB)
|
# return jsonify({"success": False, "error": "missing params"}), 400
|
||||||
conn.execute("UPDATE Users SET password_hash=? WHERE email=?", (new_hash, email))
|
# conn = _sql.connect(GATEWAY_DB)
|
||||||
conn.commit()
|
# conn.execute("UPDATE Users SET password_hash=? WHERE email=?", (new_hash, email))
|
||||||
conn.close()
|
# conn.commit()
|
||||||
logs.info("static", "密码重置", extra={"email": email[:3] + "***"})
|
# conn.close()
|
||||||
return jsonify({"success": True})
|
# logs.info("static", "密码重置", extra={"email": email[:3] + "***"})
|
||||||
|
# return jsonify({"success": True})
|
||||||
|
|
||||||
|
|
||||||
@app.route('/api/check_user', methods=['POST'])
|
@app.route('/api/check_user', methods=['POST'])
|
||||||
|
|||||||
Reference in new issue
Block a user