Session sin expiracion, mostrar IP de red
This commit is contained in:
@@ -23,7 +23,6 @@ def create_token(user_id: int, username: str) -> str:
|
||||
payload = {
|
||||
"user_id": user_id,
|
||||
"username": username,
|
||||
"exp": datetime.utcnow() + timedelta(hours=ACCESS_TOKEN_EXPIRE_HOURS),
|
||||
}
|
||||
return jwt.encode(payload, SECRET_KEY, algorithm=ALGORITHM)
|
||||
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ async def login(
|
||||
|
||||
token = create_token(user["id"], user["username"])
|
||||
resp = RedirectResponse("/dashboard", status_code=302)
|
||||
resp.set_cookie(key="token", value=token, httponly=True, max_age=43200)
|
||||
resp.set_cookie(key="token", value=token, httponly=True)
|
||||
return resp
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
Reference in New Issue
Block a user