Логин + SQL инъекции
This commit is contained in:
parent
e01363d916
commit
47cb2fb2c7
2 changed files with 39 additions and 12 deletions
10
API/main.py
10
API/main.py
|
|
@ -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"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue