Skip to content

Commit

Permalink
improve token expiration
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-XT committed Jul 4, 2024
1 parent 2da92a6 commit ae88394
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion agixt/MagicalAuth.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,15 @@ def send_magic_link(
raise HTTPException(
status_code=401, detail="Invalid MFA token. Please try again."
)
expiration = datetime.now().replace(
hour=0, minute=0, second=0, microsecond=0
) + timedelta(days=1)
self.token = jwt.encode(
{
"sub": str(user.id),
"email": self.email,
"admin": user.admin,
"exp": datetime.utcnow() + timedelta(hours=24),
"exp": expiration,
},
self.encryption_key,
algorithm="HS256",
Expand Down

0 comments on commit ae88394

Please sign in to comment.