Closed Cyborger1 closed 1 year ago
Proposed solution:
if pending_discord:
found_code = False # <---
for record in pending_discord:
pending_code = int(record.Code)
if pending_code == provided_code:
found_code = True # <---
await set_discord_verification(id=record.Entry, token=token_id)
break
if not(found_code): # <---
raise HTTPException(status_code=400, detail=f"Linking code is incorrect.") # <---
else:
raise HTTPException(status_code=400, detail=f"No pending links for this user.")
return {"ok": "ok"}
oh a logic error of mine, nice catch!
Currently, the
for
loop that checks for a pending discord link does not error out if it gets to the end of the table without finding a matching code. It just does nothing and returns "OK".Problem is located here https://github.com/Bot-detector/Bot-Detector-Core-Files/blob/30264887fd2562c52935aa3f31a72ab04b8d2ebf/api/routers/legacy.py#L1015-L1024