Merge pull request #3134 from jumpserver/v52

V52
pull/3048/head^2
BaiJiangJie 2019-08-16 16:34:20 +08:00 committed by GitHub
commit fe6f7bcfc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -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

View File

@ -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:
return redirect(referer)
else:
return redirect('index')
if referer.find(host) == -1:
return redirect(reverse('index'))
if UUID_PATTERN.search(referer):
return redirect(reverse('index'))
return redirect(referer)
class SwitchToAOrgView(View):