File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 6565app = FastAPI (title = "TraderCopilot Backend" , version = "2.0.0" )
6666
6767
68- # --- EMERGENCY ENDPOINT (TEMPORARY) ---
69- @app .get ("/debug/force-reset" )
70- def force_reset_password (email : str , new_pass : str , db : Session = Depends (get_db )):
71- """
72- Emergency tool to fix 'UnknownHashError' in Prod.
73- Usage: /debug/force-reset?email=admin@tradercopilot.app&new_pass=123456
74- """
75- from core .security import get_password_hash
76- from models_db import User
77-
78- user = db .query (User ).filter (User .email == email ).first ()
79- if not user :
80- return {"error" : "User not found" }
81-
82- print (f"[DEBUG] Resetting password for { email } ..." )
83- user .hashed_password = get_password_hash (new_pass )
84- db .commit ()
85- return {"status" : "success" , "message" : f"Password updated for { email } " }
86-
87- @app .get ("/debug/users" )
88- def debug_list_users (db : Session = Depends (get_db )):
89- """List all registered users (EMAIL ONLY) to find the admin account."""
90- from models_db import User
91- users = db .query (User ).all ()
92- return {"count" : len (users ), "emails" : [u .email for u in users ]}
93- # --- END EMERGENCY ---
94-
95-
9668@app .get ("/" )
9769def root_check ():
9870 """Root endpoint for instant health check."""
You can’t perform that action at this time.
0 commit comments