fix: refresh token exipreited
This commit is contained in:
parent
22e2bca83c
commit
23329e7d36
@ -49,7 +49,7 @@ async def get_user(connection: AsyncConnection, login: str) -> Optional[User]:
|
|||||||
return user, password
|
return user, password
|
||||||
|
|
||||||
|
|
||||||
async def upgrade_old_refresh_token(connection: AsyncConnection, user) -> Optional[User]:
|
async def upgrade_old_refresh_token(connection: AsyncConnection, user,refresh_token) -> Optional[User]:
|
||||||
|
|
||||||
new_status = KeyStatus.EXPIRED
|
new_status = KeyStatus.EXPIRED
|
||||||
|
|
||||||
@ -58,7 +58,8 @@ async def upgrade_old_refresh_token(connection: AsyncConnection, user) -> Option
|
|||||||
.where(
|
.where(
|
||||||
account_table.c.id == user.id,
|
account_table.c.id == user.id,
|
||||||
account_keyring_table.c.status == KeyStatus.ACTIVE,
|
account_keyring_table.c.status == KeyStatus.ACTIVE,
|
||||||
account_keyring_table.c.key_type == KeyType.REFRESH_TOKEN
|
account_keyring_table.c.key_type == KeyType.REFRESH_TOKEN,
|
||||||
|
account_keyring_table.c.key_value == refresh_token
|
||||||
)
|
)
|
||||||
.values(status=new_status)
|
.values(status=new_status)
|
||||||
)
|
)
|
||||||
|
@ -129,7 +129,7 @@ async def refresh(
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
||||||
await upgrade_old_refresh_token(connection,current_user)
|
await upgrade_old_refresh_token(connection,current_user,refresh_token)
|
||||||
|
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||||
|
Loading…
Reference in New Issue
Block a user