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:
parent
e92732acfe
commit
7d75f8cbdc
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user