diff --git a/api/kiwi_vpn_api/routers/user.py b/api/kiwi_vpn_api/routers/user.py index a80e557..3acd3dc 100644 --- a/api/kiwi_vpn_api/routers/user.py +++ b/api/kiwi_vpn_api/routers/user.py @@ -50,13 +50,6 @@ async def dep_get_current_user( username = await config.jwt.decode_token(token) user = schemas.User.from_db(db, username) - if user is None: - raise HTTPException( - status_code=status.HTTP_401_UNAUTHORIZED, - detail="Could not validate credentials", - headers={"WWW-Authenticate": "Bearer"}, - ) - return user @@ -64,4 +57,11 @@ async def dep_get_current_user( async def get_current_user( current_user: schemas.User = Depends(dep_get_current_user), ): + if current_user is None: + raise HTTPException( + status_code=status.HTTP_401_UNAUTHORIZED, + detail="Could not validate credentials", + headers={"WWW-Authenticate": "Bearer"}, + ) + return current_user