Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BP-1237: Fix small code bug #235

Merged
merged 3 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)



Loading