mirror of https://github.com/jumpserver/jumpserver
fix: 表单提交csrftoken问题
parent
1432fe1609
commit
37b150bc04
|
@ -79,6 +79,9 @@ function doRequestAuth() {
|
||||||
requestApi({
|
requestApi({
|
||||||
url: url,
|
url: url,
|
||||||
method: "GET",
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
"X-JMS-LOGIN-TYPE": "W"
|
||||||
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (!data.error && data.msg === 'ok') {
|
if (!data.error && data.msg === 'ok') {
|
||||||
window.onbeforeunload = function(){};
|
window.onbeforeunload = function(){};
|
||||||
|
@ -98,9 +101,6 @@ function doRequestAuth() {
|
||||||
},
|
},
|
||||||
error: function (text, data) {
|
error: function (text, data) {
|
||||||
},
|
},
|
||||||
beforeSend: function(request) {
|
|
||||||
request.setRequestHeader("X-JMS-LOGIN-TYPE", "W");
|
|
||||||
},
|
|
||||||
flash_message: false, // 是否显示flash消息
|
flash_message: false, // 是否显示flash消息
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,13 +270,13 @@ function requestApi(props) {
|
||||||
if (typeof(dataBody) === "object") {
|
if (typeof(dataBody) === "object") {
|
||||||
dataBody = JSON.stringify(dataBody)
|
dataBody = JSON.stringify(dataBody)
|
||||||
}
|
}
|
||||||
var beforeSend = props.beforeSend || function (request) {}
|
var headers = props.headers || {}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: props.url,
|
url: props.url,
|
||||||
type: props.method || "PATCH",
|
type: props.method || "PATCH",
|
||||||
|
headers: headers,
|
||||||
data: dataBody,
|
data: dataBody,
|
||||||
beforeSend: beforeSend,
|
|
||||||
contentType: props.content_type || "application/json; charset=utf-8",
|
contentType: props.content_type || "application/json; charset=utf-8",
|
||||||
dataType: props.data_type || "json"
|
dataType: props.data_type || "json"
|
||||||
}).done(function (data, textStatue, jqXHR) {
|
}).done(function (data, textStatue, jqXHR) {
|
||||||
|
|
Loading…
Reference in New Issue