mirror of https://github.com/jumpserver/jumpserver
[Update] 优化切换组织时重定向页面逻辑 (#3133)
* [Update] 优化切换组织时重定向页面逻辑 * [Update] 优化切换组织时重定向页面逻辑 2pull/3134/head
parent
7d1e8d258c
commit
48826a9ad9
|
@ -12,7 +12,7 @@ import copy
|
|||
import ipaddress
|
||||
|
||||
|
||||
UUID_PATTERN = re.compile(r'[0-9a-zA-Z\-]{36}')
|
||||
UUID_PATTERN = re.compile(r'\w{8}(-\w{4}){3}-\w{12}')
|
||||
ipip_db = None
|
||||
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ from django.http import HttpResponseForbidden
|
|||
from django.views.generic import DetailView, View
|
||||
|
||||
from .models import Organization
|
||||
from common.utils import UUID_PATTERN
|
||||
|
||||
|
||||
class SwitchOrgView(DetailView):
|
||||
|
@ -17,10 +18,11 @@ class SwitchOrgView(DetailView):
|
|||
request.session['oid'] = oid
|
||||
host = request.get_host()
|
||||
referer = request.META.get('HTTP_REFERER')
|
||||
if referer.find(host) != -1:
|
||||
if referer.find(host) == -1:
|
||||
return redirect(reverse('index'))
|
||||
if UUID_PATTERN.search(referer):
|
||||
return redirect(reverse('index'))
|
||||
return redirect(referer)
|
||||
else:
|
||||
return redirect('index')
|
||||
|
||||
|
||||
class SwitchToAOrgView(View):
|
||||
|
|
Loading…
Reference in New Issue