Browse Source

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

pull/887/head
Pavel Isaev 5 years ago
committed by Sebastián Ramírez
parent
commit
174e7b1730
  1. 2
      docs/src/security/tutorial007.py

2
docs/src/security/tutorial007.py

@ -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",

Loading…
Cancel
Save