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:
2026-05-16 17:16:26 +02:00
parent a820431707
commit e4b405cdbd
2 changed files with 29 additions and 2 deletions

View File

@@ -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):