Improve the inventory page

This commit is contained in:
Urtzi Alfaro
2025-09-17 16:06:30 +02:00
parent 7aa26d51d3
commit dcb3ce441b
39 changed files with 5852 additions and 1762 deletions

View File

@@ -156,8 +156,8 @@ class JWTHandler:
Decode JWT token without verification (for inspection purposes)
"""
try:
# Decode without verification
payload = jwt.decode(token, options={"verify_signature": False})
# Decode without verification - need to provide key but disable verification
payload = jwt.decode(token, self.secret_key, algorithms=[self.algorithm], options={"verify_signature": False})
return payload
except Exception as e:
logger.error(f"Token decoding failed: {e}")
@@ -193,12 +193,12 @@ class JWTHandler:
Useful for quick user identification
"""
try:
payload = self.decode_token_unsafe(token)
payload = self.decode_token_no_verify(token)
if payload:
return payload.get("user_id")
except Exception as e:
logger.warning(f"Failed to extract user ID from token: {e}")
return None
def get_token_info(self, token: str) -> Dict[str, Any]:
@@ -217,7 +217,7 @@ class JWTHandler:
try:
# Try unsafe decode first
payload = self.decode_token_unsafe(token)
payload = self.decode_token_no_verify(token)
if payload:
info.update({
"user_id": payload.get("user_id"),