Browse Source

[Update] 修改切换组织后页面跳转 (#3715)

pull/3716/head
老广 5 years ago committed by GitHub
parent
commit
98bb6c63f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      apps/jumpserver/conf.py
  2. 1
      apps/jumpserver/settings/custom.py
  3. 4
      apps/orgs/views.py

1
apps/jumpserver/conf.py

@ -193,6 +193,7 @@ class Config(dict):
'FORCE_SCRIPT_NAME': '',
'LOGIN_CONFIRM_ENABLE': False,
'WINDOWS_SKIP_ALL_MANUAL_PASSWORD': False,
'ORG_CHANGE_TO_URL': ''
}
def convert_type(self, k, v):

1
apps/jumpserver/settings/custom.py

@ -82,3 +82,4 @@ USER_GUIDE_URL = DYNAMIC.USER_GUIDE_URL
HTTP_LISTEN_PORT = CONFIG.HTTP_LISTEN_PORT
WS_LISTEN_PORT = CONFIG.WS_LISTEN_PORT
LOGIN_LOG_KEEP_DAYS = DYNAMIC.LOGIN_LOG_KEEP_DAYS
ORG_CHANGE_TO_URL = CONFIG.ORG_CHANGE_TO_URL

4
apps/orgs/views.py

@ -1,4 +1,5 @@
from django.shortcuts import redirect, reverse
from django.conf import settings
from django.http import HttpResponseForbidden
from django.views.generic import DetailView, View
@ -16,6 +17,9 @@ class SwitchOrgView(DetailView):
self.object = Organization.get_instance(pk)
oid = str(self.object.id)
request.session['oid'] = oid
org_change_to_url = settings.ORG_CHANGE_TO_URL
if org_change_to_url:
return redirect(org_change_to_url)
host = request.get_host()
referer = request.META.get('HTTP_REFERER', '')
if referer.find(host) == -1:

Loading…
Cancel
Save