mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-07-17 08:21:38 +00:00
[UPdate] 修改cookie设置
This commit is contained in:
parent
6d15f60c5c
commit
68ccec6b9c
@ -235,6 +235,7 @@ class AdHoc(models.Model):
|
|||||||
return result.results_raw, result.results_summary
|
return result.results_raw, result.results_summary
|
||||||
except AnsibleError as e:
|
except AnsibleError as e:
|
||||||
logger.error("Failed run adhoc {}, {}".format(self.task.name, e))
|
logger.error("Failed run adhoc {}, {}".format(self.task.name, e))
|
||||||
|
pass
|
||||||
|
|
||||||
@become.setter
|
@become.setter
|
||||||
def become(self, item):
|
def become(self, item):
|
||||||
|
@ -357,5 +357,16 @@ String.prototype.format = function(args) {
|
|||||||
function setCookie(key, value) {
|
function setCookie(key, value) {
|
||||||
var expires = new Date();
|
var expires = new Date();
|
||||||
expires.setTime(expires.getTime() + (24 * 60 * 60 * 1000));
|
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=/';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,15 +37,19 @@
|
|||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
})
|
})
|
||||||
.on('click', '#switch_admin', function () {
|
.on('click', '#switch_admin', function () {
|
||||||
|
var cookieName = "IN_ADMIN_PAGE";
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
setCookie("IN_ADMIN_PAGE", "Yes");
|
delCookie(cookieName);
|
||||||
|
setCookie(cookieName, "Yes");
|
||||||
window.location = "/"
|
window.location = "/"
|
||||||
}, 100)
|
}, 100)
|
||||||
})
|
})
|
||||||
.on('click', '#switch_user', function () {
|
.on('click', '#switch_user', function () {
|
||||||
|
var cookieName = "IN_ADMIN_PAGE";
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
console.log("Set to No");
|
console.log("Set to No");
|
||||||
setCookie("IN_ADMIN_PAGE", "No");
|
delCookie(cookieName);
|
||||||
|
setCookie(cookieName, "No");
|
||||||
window.location = "/"
|
window.location = "/"
|
||||||
}, 100);
|
}, 100);
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user