Ver Fonte

debug: add logs to verify-reset-token (take 2)

unknown há 2 dias atrás
pai
commit
521fbcca72
1 ficheiros alterados com 12 adições e 3 exclusões
  1. 12 3
      backend/routers/auth.py

+ 12 - 3
backend/routers/auth.py

@@ -188,19 +188,28 @@ async def forgot_password(request: schemas.ForgotPassword, lang: str = "en"):
 
 @router.api_route("/verify-reset-token", methods=["GET", "POST"])
 async def verify_reset_token(request: Request):
+    # DEBUG LOGS
+    print(f"DEBUG: verify_reset_token method={request.method}")
+    print(f"DEBUG: query_params={request.query_params}")
+    
     # Try Query param first (GET or POST)
     token = request.query_params.get("token")
     
-    # Try Body if POST and token still missing
+    # Try Body if POST
     if request.method == "POST":
         try:
+            raw_body = await request.body()
+            print(f"DEBUG: raw_body={raw_body}")
             body = await request.json()
+            print(f"DEBUG: parsed_json={body}")
             if body and body.get("token"):
                 token = body.get("token")
-        except Exception:
-            # Fallback if body is not JSON or empty
+        except Exception as e:
+            print(f"DEBUG: body parse error: {e}")
             pass
             
+    print(f"DEBUG: final token found: {token}")
+    
     if not token:
         raise HTTPException(status_code=400, detail="Token required")