mirror of https://github.com/langgenius/dify.git
fix: refresh token
This commit is contained in:
parent
9f90d70b38
commit
040a6fbc5f
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue