fix(task7): invalidate tokens on password change or reset

This commit is contained in:
Atharv1705
2026-11-17 18:31:45 +05:30
parent b8639bc52a
commit 9276064d18
11 changed files with 145 additions and 4 deletions
+2
View File
@@ -92,6 +92,8 @@ def hash_password(plain: str) -> str:
def create_access_token(data: dict, expires_minutes: int | None = None) -> str:
to_encode = data.copy()
if "tv" not in to_encode:
to_encode["tv"] = 0
expire = utc_now() + timedelta(minutes=expires_minutes or settings.ACCESS_TOKEN_EXPIRE_MINUTES)
to_encode["exp"] = expire
return jwt.encode(to_encode, settings.SECRET_KEY, algorithm=settings.ALGORITHM)