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
68ccec6b
Commit
68ccec6b
authored
Jan 02, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[UPdate] 修改cookie设置
parent
6d15f60c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
3 deletions
+19
-3
models.py
apps/ops/models.py
+1
-0
jumpserver.js
apps/static/js/jumpserver.js
+12
-1
_user_profile.html
apps/templates/_user_profile.html
+6
-2
No files found.
apps/ops/models.py
View file @
68ccec6b
...
...
@@ -235,6 +235,7 @@ class AdHoc(models.Model):
return
result
.
results_raw
,
result
.
results_summary
except
AnsibleError
as
e
:
logger
.
error
(
"Failed run adhoc {}, {}"
.
format
(
self
.
task
.
name
,
e
))
pass
@become.setter
def
become
(
self
,
item
):
...
...
apps/static/js/jumpserver.js
View file @
68ccec6b
...
...
@@ -357,5 +357,16 @@ String.prototype.format = function(args) {
function
setCookie
(
key
,
value
)
{
var
expires
=
new
Date
();
expires
.
setTime
(
expires
.
getTime
()
+
(
24
*
60
*
60
*
1000
));
document
.
cookie
=
key
+
'='
+
value
+
';expires='
+
expires
.
toUTCString
();
document
.
cookie
=
key
+
'='
+
value
+
';expires='
+
expires
.
toUTCString
()
+
';path=/'
;
console
.
log
(
"Cookie: "
+
document
.
cookie
)
}
function
delCookie
(
key
)
{
var
expires
=
new
Date
();
expires
.
setTime
(
expires
.
getTime
()
-
1
);
var
val
=
getCookie
(
key
);
if
(
val
!==
null
)
{
document
.
cookie
=
key
+
'='
+
val
+
";expires"
+
expires
.
toUTCString
()
+
';path=/'
;
}
}
apps/templates/_user_profile.html
View file @
68ccec6b
...
...
@@ -37,15 +37,19 @@
$
(
document
).
ready
(
function
()
{
})
.
on
(
'click'
,
'#switch_admin'
,
function
()
{
var
cookieName
=
"IN_ADMIN_PAGE"
;
setTimeout
(
function
()
{
setCookie
(
"IN_ADMIN_PAGE"
,
"Yes"
);
delCookie
(
cookieName
);
setCookie
(
cookieName
,
"Yes"
);
window
.
location
=
"/"
},
100
)
})
.
on
(
'click'
,
'#switch_user'
,
function
()
{
var
cookieName
=
"IN_ADMIN_PAGE"
;
setTimeout
(
function
()
{
console
.
log
(
"Set to No"
);
setCookie
(
"IN_ADMIN_PAGE"
,
"No"
);
delCookie
(
cookieName
);
setCookie
(
cookieName
,
"No"
);
window
.
location
=
"/"
},
100
);
})
...
...
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