fix: refresh token

This commit is contained in:
Yeuoly 2024-12-16 19:41:50 +08:00
parent 9f90d70b38
commit 040a6fbc5f
No known key found for this signature in database
GPG Key ID: A66E7E320FB19F61
1 changed files with 3 additions and 3 deletions

View File

@ -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()