Skip to content

Commit

Permalink
Merge pull request #235 from MOV-AI/bugfix/BP-1237/small-code-fix
Browse files Browse the repository at this point in the history
BP-1237: Fix small code bug
  • Loading branch information
andreparames authored Sep 3, 2024
2 parents 3de499d + 6350799 commit fcced56
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/TestOnPR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:

steps:
- name: Download generated python artifact
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: packages
path: dist
Expand Down
7 changes: 5 additions & 2 deletions dal/classes/utils/token.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ def verify_token(cls, token: str) -> None:
if not isinstance(token, str):
error_msg = "Token must be a string!"
raise TokenError(error_msg)

token_id = None
try:
token_id = cls.get_token_id(token)
#cls.log.debug(f"Verifying token id {token_id}")
Expand All @@ -293,7 +295,8 @@ def verify_token(cls, token: str) -> None:
except (jwt.ExpiredSignatureError, jwt.DecodeError, jwt.InvalidTokenError) as e:
error_msg = f"Failed to verify token: {e}"
cls.log.warning(error_msg)
cls._token_manager.remove_token(token_id)
if token_id is not None:
cls._token_manager.remove_token(token_id)
raise TokenExpired(error_msg)

@classmethod
Expand Down Expand Up @@ -429,4 +432,4 @@ def generate_refresh_token(cls, user: BaseUser) -> str:
"""
return cls._generate_user_token(user, "Refresh", JWT_REFRESH_EXPIRATION_DELTA)



0 comments on commit fcced56

Please sign in to comment.