1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-02 15:57:31 +00:00

Update repo_api_tokens.py (#6853)

This commit is contained in:
Ranjiwei 2024-09-27 12:28:14 +08:00 committed by GitHub
parent e92732acfe
commit 7d75f8cbdc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,5 +1,6 @@
import logging
import jwt
import time
from rest_framework import status
from rest_framework.authentication import SessionAuthentication
from rest_framework.permissions import IsAuthenticated
@ -180,7 +181,7 @@ class RepoNotificationJwtTokenView(APIView):
payload = {
'username': username,
'repo_id': repo_id,
'exp': 3 * 3600 * 24 # default by three days
'exp': int(time.time()) + 3 * 3600 * 24 # default by three days
}
jwt_token = jwt.encode(payload, JWT_PRIVATE_KEY, algorithm='HS256')
except Exception as e: