🔒 Check both username and password in security tutorial (#865)

This commit is contained in:
Pavel Isaev 2020-01-17 13:49:54 +02:00 committed by Sebastián Ramírez
parent 874d24181e
commit 174e7b1730
1 changed files with 1 additions and 1 deletions

View File

@ -12,7 +12,7 @@ security = HTTPBasic()
def get_current_username(credentials: HTTPBasicCredentials = Depends(security)):
correct_username = secrets.compare_digest(credentials.username, "stanleyjobson")
correct_password = secrets.compare_digest(credentials.password, "swordfish")
if not correct_username and correct_password:
if not (correct_username and correct_password):
raise HTTPException(
status_code=HTTP_401_UNAUTHORIZED,
detail="Incorrect email or password",