From 8ae98887ee072ec567394db0fbf64087a70e8ba4 Mon Sep 17 00:00:00 2001 From: "Jiangjie.Bai" Date: Fri, 19 Aug 2022 14:19:47 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"fix:=20=E4=BF=AE=E5=A4=8D=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E7=AB=AF=E6=B8=B2=E6=9F=93=E8=AF=B7=E6=B1=82=E7=BC=BA?= =?UTF-8?q?=E5=B0=91csrf=20token=20=E9=97=AE=E9=A2=98"=20(#8780)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 24a1738e731b604dc79b1eb281a1ac934869121b. --- .../templates/authentication/login_wait_confirm.html | 3 +++ apps/static/js/jumpserver.js | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/authentication/templates/authentication/login_wait_confirm.html b/apps/authentication/templates/authentication/login_wait_confirm.html index 6107b3bc8..a74c8db26 100644 --- a/apps/authentication/templates/authentication/login_wait_confirm.html +++ b/apps/authentication/templates/authentication/login_wait_confirm.html @@ -98,6 +98,9 @@ function doRequestAuth() { }, error: function (text, data) { }, + beforeSend: function(request) { + request.setRequestHeader("X-JMS-LOGIN-TYPE", "W"); + }, flash_message: false, // 是否显示flash消息 }) } diff --git a/apps/static/js/jumpserver.js b/apps/static/js/jumpserver.js index 974652bb1..e3537cb84 100644 --- a/apps/static/js/jumpserver.js +++ b/apps/static/js/jumpserver.js @@ -132,7 +132,6 @@ function setAjaxCSRFToken() { $.ajaxSetup({ beforeSend: function (xhr, settings) { - xhr.setRequestHeader("X-JMS-LOGIN-TYPE", "W"); if (!csrfSafeMethod(settings.type) && !this.crossDomain) { xhr.setRequestHeader("X-CSRFToken", csrftoken); } @@ -271,11 +270,13 @@ function requestApi(props) { if (typeof(dataBody) === "object") { dataBody = JSON.stringify(dataBody) } + var beforeSend = props.beforeSend || function (request) {} $.ajax({ url: props.url, type: props.method || "PATCH", data: dataBody, + beforeSend: beforeSend, contentType: props.content_type || "application/json; charset=utf-8", dataType: props.data_type || "json" }).done(function (data, textStatue, jqXHR) {