aboutsummaryrefslogtreecommitdiffstats
path: root/backend/authentication/user.py
diff options
context:
space:
mode:
Diffstat (limited to 'backend/authentication/user.py')
-rw-r--r--backend/authentication/user.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/backend/authentication/user.py b/backend/authentication/user.py
index 857c2ed..18fa935 100644
--- a/backend/authentication/user.py
+++ b/backend/authentication/user.py
@@ -1,3 +1,4 @@
+import logging
import typing as t
import jwt
@@ -7,6 +8,8 @@ from starlette.requests import Request
from backend.constants import SECRET_KEY
from backend.discord import fetch_user_details
+logger = logging.getLogger(__name__)
+
class User(BaseUser):
"""Starlette BaseUser implementation for JWT authentication."""
@@ -35,6 +38,7 @@ class User(BaseUser):
return jwt.decode(self.token, SECRET_KEY, algorithms=["HS256"])
async def fetch_admin_status(self, request: Request) -> bool:
+ logger.debug(f"Checking admin status for user with ID: {self.payload['id']}")
self.admin = await request.state.db.admins.find_one(
{"_id": self.payload["id"]}
) is not None
@@ -43,6 +47,7 @@ class User(BaseUser):
async def refresh_data(self) -> None:
"""Fetches user data from discord, and updates the instance."""
+ logger.debug(f"Updating user info for user with ID: {self.payload['id']}")
self.payload = await fetch_user_details(self.decoded_token.get("token"))
updated_info = self.decoded_token