Commit 8e7380c8 authored by impfundev's avatar impfundev

fix: extend token lifetime to 2 hours

parent 6f4354e6
......@@ -27,9 +27,7 @@ class AuthMiddleware(MiddlewareMixin):
near_expired = expired_time - timedelta(minutes=5)
if datetime.now() >= near_expired:
payload["exp"] = (
payload["exp"] + timedelta(minutes=15).total_seconds()
)
payload["exp"] = payload["exp"] + timedelta(hours=2).total_seconds()
new_token = jwt.encode(
payload, settings.JWT_SECRET, algorithm="HS256"
)
......
......@@ -25,7 +25,7 @@ class AuthView(TemplateView):
password=form.data["password"],
)
expiration_time = datetime.now() + timedelta(minutes=15)
expiration_time = datetime.now() + timedelta(hours=2)
payload = {
"exp": expiration_time.timestamp(),
"librarian_id": librarian.id,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment