Логин + SQL инъекции

This commit is contained in:
Lev 2025-11-27 21:02:26 +03:00
parent e01363d916
commit 47cb2fb2c7
2 changed files with 39 additions and 12 deletions

View file

@ -5,9 +5,17 @@ app = FastAPI()
db = utils.DataBase("")
@app.post("/registration")
def reg(email: str, password: str) :
def registration(email: str, password: str) :
answer = db.registration(email, password)
if answer["code"] == 1 :
HTTPException(400, "Email is busy.")
else :
return answer["data"]
@app.post("/login")
def login(email: str, password: str) :
answer = db.login(email, password)
if answer["code"] == 1 :
HTTPException(400, "Incorrect email or password.")
else :
return answer["data"]