From 040a6fbc5fd6bb478f29d0ae7c520c7e78d50293 Mon Sep 17 00:00:00 2001 From: Yeuoly Date: Mon, 16 Dec 2024 19:41:50 +0800 Subject: [PATCH] fix: refresh token --- api/services/account_service.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/services/account_service.py b/api/services/account_service.py index 6257f1d3c9..57eabd5b6a 100644 --- a/api/services/account_service.py +++ b/api/services/account_service.py @@ -322,9 +322,6 @@ class AccountService: @staticmethod def refresh_token(refresh_token: str) -> TokenPair: - if not AccountService.verify_account_whitelist(refresh_token): - raise ValueError("Account is not whitelisted") - # Verify the refresh token account_id = redis_client.get(AccountService._get_refresh_token_key(refresh_token)) if not account_id: @@ -334,6 +331,9 @@ class AccountService: if not account: raise ValueError("Invalid account") + if not AccountService.verify_account_whitelist(account.email): + raise ValueError("Account is not whitelisted") + # Generate new access token and refresh token new_access_token = AccountService.get_account_jwt_token(account) new_refresh_token = _generate_refresh_token()