Revert "Merge get_user into authenticate_user, it was only doing one db call"
ups, das war ja doch von mehr verwendet...
This reverts commit 0337a90f15.
This commit is contained in:
@@ -26,8 +26,14 @@ def verify_password(plain_password, hashed_password):
|
||||
def get_password_hash(password):
|
||||
return password_hash.hash(password)
|
||||
|
||||
def authenticate_user(db, username: str, password: str):
|
||||
def get_user(db, username: str):
|
||||
user = db.exec(select(UserDB).where(UserDB.name == username)).first()
|
||||
if user is None:
|
||||
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Username not found in get_user, this shouldn't happen")
|
||||
return user
|
||||
|
||||
def authenticate_user(db, username: str, password: str):
|
||||
user = get_user(db, username)
|
||||
if not user:
|
||||
return False
|
||||
if not verify_password(password, user.passwordhash):
|
||||
|
||||
Reference in New Issue
Block a user