mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-23 20:37:42 +00:00
Update internal_api.py (#6661)
* Update internal_api.py * update * Update utils.py * Update utils.py * update * Update utils.py * Update settings.py
This commit is contained in:
@@ -33,7 +33,9 @@ from seahub.avatar.templatetags.avatar_tags import api_avatar_url
|
|||||||
from seahub.utils import get_user_repos
|
from seahub.utils import get_user_repos
|
||||||
from seahub.utils.mail import send_html_email_with_dj_template
|
from seahub.utils.mail import send_html_email_with_dj_template
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
from seahub.settings import SECRET_KEY
|
import seahub.settings as settings
|
||||||
|
|
||||||
|
JWT_PRIVATE_KEY = getattr(settings, 'JWT_PRIVATE_KEY', '')
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -331,7 +333,7 @@ def is_valid_internal_jwt(auth):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
payload = jwt.decode(token, SECRET_KEY, algorithms=['HS256'])
|
payload = jwt.decode(token, JWT_PRIVATE_KEY, algorithms=['HS256'])
|
||||||
except:
|
except:
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
|
@@ -122,6 +122,8 @@ STATICFILES_FINDERS = (
|
|||||||
# Make this unique, and don't share it with anybody.
|
# Make this unique, and don't share it with anybody.
|
||||||
SECRET_KEY = 'n*v0=jz-1rz@(4gx^tf%6^e7c&um@2)g-l=3_)t@19a69n1nv6'
|
SECRET_KEY = 'n*v0=jz-1rz@(4gx^tf%6^e7c&um@2)g-l=3_)t@19a69n1nv6'
|
||||||
|
|
||||||
|
JWT_PRIVATE_KEY = ''
|
||||||
|
|
||||||
ENABLE_REMOTE_USER_AUTHENTICATION = False
|
ENABLE_REMOTE_USER_AUTHENTICATION = False
|
||||||
|
|
||||||
# Order is important
|
# Order is important
|
||||||
@@ -970,6 +972,8 @@ else:
|
|||||||
load_local_settings(seahub_settings)
|
load_local_settings(seahub_settings)
|
||||||
del seahub_settings
|
del seahub_settings
|
||||||
|
|
||||||
|
JWT_PRIVATE_KEY = os.environ.get('JWT_PRIVATE_KEY', '') or JWT_PRIVATE_KEY
|
||||||
|
|
||||||
# Remove install_topdir from path
|
# Remove install_topdir from path
|
||||||
sys.path.pop(0)
|
sys.path.pop(0)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user