This commit is contained in:
2026-04-08 00:36:51 +03:00
parent 65192f373b
commit 0ae39ecacc

View File

@@ -93,6 +93,7 @@ def register(req: RegisterRequest, db: Session = Depends(get_db)):
email = req.email.strip().lower() email = req.email.strip().lower()
if not email or not req.password: if not email or not req.password:
raise HTTPException(status_code=400, detail="Email and password are required") raise HTTPException(status_code=400, detail="Email and password are required")
pw_bytes_len = len(req.password.encode("utf-8"))
_password_ok_or_400(req.password) _password_ok_or_400(req.password)
try: try:
@@ -118,7 +119,10 @@ def register(req: RegisterRequest, db: Session = Depends(get_db)):
raise HTTPException(status_code=500, detail=f"Database error: {str(e)}") raise HTTPException(status_code=500, detail=f"Database error: {str(e)}")
except Exception as e: except Exception as e:
db.rollback() db.rollback()
raise HTTPException(status_code=500, detail=f"Internal error: {str(e)}") raise HTTPException(
status_code=500,
detail=f"Internal error: {str(e)} (password_bytes_len={pw_bytes_len})",
)
@app.post("/auth/login") @app.post("/auth/login")