formatting fixes
This commit is contained in:
@@ -80,16 +80,12 @@ 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)
|
||||
token_repo.store(access_token, user_id=user["id"], ttl=3600)
|
||||
|
||||
Reference in New Issue
Block a user