From 89afc5b69c58fac7c45427546b9e7781e1b1285d Mon Sep 17 00:00:00 2001 From: andreparames Date: Tue, 3 Sep 2024 09:30:26 +0100 Subject: [PATCH 1/3] BP-1237: Fix small code bug --- dal/classes/utils/token.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dal/classes/utils/token.py b/dal/classes/utils/token.py index 3255abe8..7102a3ab 100644 --- a/dal/classes/utils/token.py +++ b/dal/classes/utils/token.py @@ -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}") @@ -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 @@ -429,4 +432,4 @@ def generate_refresh_token(cls, user: BaseUser) -> str: """ return cls._generate_user_token(user, "Refresh", JWT_REFRESH_EXPIRATION_DELTA) - \ No newline at end of file + From e09696bbe54d80b1dc26d6f78a2032429e97b089 Mon Sep 17 00:00:00 2001 From: mariana-dias-alves <139454338+mariana-dias-alves@users.noreply.github.com> Date: Tue, 3 Sep 2024 09:43:13 +0100 Subject: [PATCH 2/3] Update upload artifacts action due to deprecation --- .github/workflows/TestOnPR.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/TestOnPR.yml b/.github/workflows/TestOnPR.yml index 598248fd..73cef923 100644 --- a/.github/workflows/TestOnPR.yml +++ b/.github/workflows/TestOnPR.yml @@ -31,7 +31,7 @@ jobs: steps: - name: Download generated python artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: packages path: dist From 6350799731b83871bf703c25c1de315bf533eedb Mon Sep 17 00:00:00 2001 From: mariana-dias-alves <139454338+mariana-dias-alves@users.noreply.github.com> Date: Tue, 3 Sep 2024 09:48:55 +0100 Subject: [PATCH 3/3] match versions in CI --- .github/workflows/TestOnPR.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/TestOnPR.yml b/.github/workflows/TestOnPR.yml index 73cef923..486ee422 100644 --- a/.github/workflows/TestOnPR.yml +++ b/.github/workflows/TestOnPR.yml @@ -31,7 +31,7 @@ jobs: steps: - name: Download generated python artifact - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v3 with: name: packages path: dist