api.user.py:

更新logout安全ttl
This commit is contained in:
Miyamizu-MitsuhaSang 2025-08-30 16:12:45 +08:00
parent c1d9e1c3fa
commit f675e5ce95
1 changed files with 1 additions and 1 deletions

View File

@ -99,7 +99,7 @@ async def user_logout(request: Request,
exp = payload.get("exp") exp = payload.get("exp")
now = datetime.now(timezone.utc).timestamp() now = datetime.now(timezone.utc).timestamp()
ttl = int(exp - now) if exp else 7200 ttl = max(int(exp - now), 1) if exp else 7200
# try: # try:
# payload = jwt.decode(raw_token, SECRET_KEY, algorithms=["HS256"]) # payload = jwt.decode(raw_token, SECRET_KEY, algorithms=["HS256"])