mirror of https://gitee.com/y_project/RuoYi.git
优化csrf名称,防止nginx代理无法识别问题(IC5B9C)
parent
b03b9736f5
commit
2b8d00b756
|
@ -6450,7 +6450,7 @@
|
||||||
textEncoding: 'UTF-8',
|
textEncoding: 'UTF-8',
|
||||||
preProcessUpload: null,
|
preProcessUpload: null,
|
||||||
ajaxSettings: { headers: {
|
ajaxSettings: { headers: {
|
||||||
"csrf_token": document.querySelector('meta[name="csrf-token"]').content
|
"X-CSRF-Token": document.querySelector('meta[name="csrf-token"]').content
|
||||||
}},
|
}},
|
||||||
ajaxDeleteSettings: {},
|
ajaxDeleteSettings: {},
|
||||||
showAjaxErrorDetails: true,
|
showAjaxErrorDetails: true,
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -576,7 +576,7 @@ $.ajaxSetup({
|
||||||
beforeSend: function (xhr, settings) {
|
beforeSend: function (xhr, settings) {
|
||||||
var csrftoken = $('meta[name=csrf-token]').attr('content')
|
var csrftoken = $('meta[name=csrf-token]').attr('content')
|
||||||
if (($.common.equalsIgnoreCase(settings.type, "POST"))) {
|
if (($.common.equalsIgnoreCase(settings.type, "POST"))) {
|
||||||
xhr.setRequestHeader("csrf_token", csrftoken)
|
xhr.setRequestHeader("X-CSRF-Token", csrftoken)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
complete: function(XMLHttpRequest, textStatus) {
|
complete: function(XMLHttpRequest, textStatus) {
|
||||||
|
|
|
@ -1053,7 +1053,7 @@ var table = {
|
||||||
beforeSend: function (xhr, settings) {
|
beforeSend: function (xhr, settings) {
|
||||||
var csrftoken = $('meta[name=csrf-token]').attr('content');
|
var csrftoken = $('meta[name=csrf-token]').attr('content');
|
||||||
if ($.common.equalsIgnoreCase(settings.type, "POST")) {
|
if ($.common.equalsIgnoreCase(settings.type, "POST")) {
|
||||||
xhr.setRequestHeader("csrf_token", csrftoken);
|
xhr.setRequestHeader("X-CSRF-Token", csrftoken);
|
||||||
}
|
}
|
||||||
$.modal.loading("正在处理中,请稍候...");
|
$.modal.loading("正在处理中,请稍候...");
|
||||||
},
|
},
|
||||||
|
@ -1237,7 +1237,7 @@ var table = {
|
||||||
beforeSend: function (xhr, settings) {
|
beforeSend: function (xhr, settings) {
|
||||||
var csrftoken = $('meta[name=csrf-token]').attr('content');
|
var csrftoken = $('meta[name=csrf-token]').attr('content');
|
||||||
if (($.common.equalsIgnoreCase(settings.type, "POST"))) {
|
if (($.common.equalsIgnoreCase(settings.type, "POST"))) {
|
||||||
xhr.setRequestHeader("csrf_token", csrftoken);
|
xhr.setRequestHeader("X-CSRF-Token", csrftoken);
|
||||||
}
|
}
|
||||||
$.modal.loading("正在处理中,请稍候...");
|
$.modal.loading("正在处理中,请稍候...");
|
||||||
$.modal.disable();
|
$.modal.disable();
|
||||||
|
@ -1261,7 +1261,7 @@ var table = {
|
||||||
beforeSend: function (xhr, settings) {
|
beforeSend: function (xhr, settings) {
|
||||||
var csrftoken = $('meta[name=csrf-token]').attr('content');
|
var csrftoken = $('meta[name=csrf-token]').attr('content');
|
||||||
if (($.common.equalsIgnoreCase(settings.type, "POST"))) {
|
if (($.common.equalsIgnoreCase(settings.type, "POST"))) {
|
||||||
xhr.setRequestHeader("csrf_token", csrftoken);
|
xhr.setRequestHeader("X-CSRF-Token", csrftoken);
|
||||||
}
|
}
|
||||||
$.modal.loading("正在处理中,请稍候...");
|
$.modal.loading("正在处理中,请稍候...");
|
||||||
},
|
},
|
||||||
|
@ -1291,7 +1291,7 @@ var table = {
|
||||||
beforeSend: function (xhr, settings) {
|
beforeSend: function (xhr, settings) {
|
||||||
var csrftoken = $('meta[name=csrf-token]').attr('content');
|
var csrftoken = $('meta[name=csrf-token]').attr('content');
|
||||||
if (($.common.equalsIgnoreCase(settings.type, "POST"))) {
|
if (($.common.equalsIgnoreCase(settings.type, "POST"))) {
|
||||||
xhr.setRequestHeader("csrf_token", csrftoken);
|
xhr.setRequestHeader("X-CSRF-Token", csrftoken);
|
||||||
}
|
}
|
||||||
$.modal.loading("正在处理中,请稍候...");
|
$.modal.loading("正在处理中,请稍候...");
|
||||||
},
|
},
|
||||||
|
|
|
@ -97,7 +97,7 @@
|
||||||
data: { password: password },
|
data: { password: password },
|
||||||
beforeSend: function(xhr) {
|
beforeSend: function(xhr) {
|
||||||
var csrftoken = $('meta[name=csrf-token]').attr('content');
|
var csrftoken = $('meta[name=csrf-token]').attr('content');
|
||||||
xhr.setRequestHeader("csrf_token", csrftoken);
|
xhr.setRequestHeader("X-CSRF-Token", csrftoken);
|
||||||
index = layer.load(2, {shade: false});
|
index = layer.load(2, {shade: false});
|
||||||
},
|
},
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
|
|
|
@ -33,10 +33,15 @@ public class ShiroConstants
|
||||||
public static final String ERROR = "errorMsg";
|
public static final String ERROR = "errorMsg";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* csrf key
|
* csrf meta content
|
||||||
*/
|
*/
|
||||||
public static final String CSRF_TOKEN = "csrf_token";
|
public static final String CSRF_TOKEN = "csrf_token";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* csrf request header
|
||||||
|
*/
|
||||||
|
public static final String X_CSRF_TOKEN = "X-CSRF-Token";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当前在线会话
|
* 当前在线会话
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class CsrfValidateFilter extends AccessControlFilter
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return validateResponse(httpServletRequest, httpServletRequest.getHeader(ShiroConstants.CSRF_TOKEN));
|
return validateResponse(httpServletRequest, httpServletRequest.getHeader(ShiroConstants.X_CSRF_TOKEN));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean validateResponse(HttpServletRequest request, String requestToken)
|
public boolean validateResponse(HttpServletRequest request, String requestToken)
|
||||||
|
|
Loading…
Reference in New Issue