formatting fixes
Build and Push Docker Image / build-and-push (pull_request) Successful in 58s
Python Code Quality / python-code-quality (pull_request) Successful in 10s
Python Test / python-test (pull_request) Successful in 17s

This commit is contained in:
Brian Bjarke Jensen
2025-11-07 23:56:38 +01:00
parent ef1c7f83b6
commit 19a211121c
3 changed files with 12 additions and 18 deletions
@@ -50,9 +50,7 @@ def _ensure_admin_user() -> None:
db = SessionLocal()
try:
# Check if admin user exists
admin_user = db.query(User).filter(
User.username == admin_username
).first()
admin_user = db.query(User).filter(User.username == admin_username).first()
hashed_pw = hash_password(admin_password)
@@ -42,7 +42,7 @@ class InMemoryTokenRepository(TokenRepositoryInterface):
def cleanup_expired(self) -> None:
"""Remove expired tokens."""
now = datetime.utcnow()
now = datetime.now(UTC)
expired_tokens = [
token for token, (_, expiry) in self._tokens.items() if now > expiry
]
+2 -6
View File
@@ -80,15 +80,11 @@ def login(
# Check if user exists in database
user = user_repo.get_by_username(credentials.username)
if not user:
raise HTTPException(
status_code=401, detail="Invalid username or password"
)
raise HTTPException(status_code=401, detail="Invalid username or password")
# Verify password using bcrypt
if not verify_password(credentials.password, user["hashed_password"]):
raise HTTPException(
status_code=401, detail="Invalid username or password"
)
raise HTTPException(status_code=401, detail="Invalid username or password")
# Generate a secure random token
access_token = secrets.token_urlsafe(32)