Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
48826a9a
Unverified
Commit
48826a9a
authored
Aug 16, 2019
by
BaiJiangJie
Committed by
GitHub
Aug 16, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 优化切换组织时重定向页面逻辑 (#3133)
* [Update] 优化切换组织时重定向页面逻辑 * [Update] 优化切换组织时重定向页面逻辑 2
parent
7d1e8d25
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
common.py
apps/common/utils/common.py
+1
-1
views.py
apps/orgs/views.py
+6
-4
No files found.
apps/common/utils/common.py
View file @
48826a9a
...
@@ -12,7 +12,7 @@ import copy
...
@@ -12,7 +12,7 @@ import copy
import
ipaddress
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
ipip_db
=
None
...
...
apps/orgs/views.py
View file @
48826a9a
...
@@ -4,6 +4,7 @@ from django.http import HttpResponseForbidden
...
@@ -4,6 +4,7 @@ from django.http import HttpResponseForbidden
from
django.views.generic
import
DetailView
,
View
from
django.views.generic
import
DetailView
,
View
from
.models
import
Organization
from
.models
import
Organization
from
common.utils
import
UUID_PATTERN
class
SwitchOrgView
(
DetailView
):
class
SwitchOrgView
(
DetailView
):
...
@@ -17,10 +18,11 @@ class SwitchOrgView(DetailView):
...
@@ -17,10 +18,11 @@ class SwitchOrgView(DetailView):
request
.
session
[
'oid'
]
=
oid
request
.
session
[
'oid'
]
=
oid
host
=
request
.
get_host
()
host
=
request
.
get_host
()
referer
=
request
.
META
.
get
(
'HTTP_REFERER'
)
referer
=
request
.
META
.
get
(
'HTTP_REFERER'
)
if
referer
.
find
(
host
)
!=
-
1
:
if
referer
.
find
(
host
)
==
-
1
:
return
redirect
(
referer
)
return
redirect
(
reverse
(
'index'
))
else
:
if
UUID_PATTERN
.
search
(
referer
):
return
redirect
(
'index'
)
return
redirect
(
reverse
(
'index'
))
return
redirect
(
referer
)
class
SwitchToAOrgView
(
View
):
class
SwitchToAOrgView
(
View
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment