init
This commit is contained in:
@@ -21,7 +21,7 @@ async def get_current_admin(
|
||||
"""Dependency that validates JWT and returns the current admin user."""
|
||||
token = credentials.credentials
|
||||
payload = decode_access_token(token)
|
||||
if not payload:
|
||||
if not payload or payload.get("type", "admin") != "admin":
|
||||
logger.warning("Invalid or expired token")
|
||||
raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail="Невалидный или просроченный токен")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user