1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-07 18:03:48 +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

View File

@@ -1,5 +1,6 @@
import logging import logging
import jwt import jwt
import time
from rest_framework import status from rest_framework import status
from rest_framework.authentication import SessionAuthentication from rest_framework.authentication import SessionAuthentication
from rest_framework.permissions import IsAuthenticated from rest_framework.permissions import IsAuthenticated
@@ -180,7 +181,7 @@ class RepoNotificationJwtTokenView(APIView):
payload = { payload = {
'username': username, 'username': username,
'repo_id': repo_id, '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') jwt_token = jwt.encode(payload, JWT_PRIVATE_KEY, algorithm='HS256')
except Exception as e: except Exception as e: