mirror of https://github.com/apache/archiva.git
[MRM-2022] Switching from beforeSend to ajax handler for header setting
This commit is contained in:
parent
8ed54feb58
commit
7d0aec48c3
|
@ -860,17 +860,15 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
|
||||||
return $.inArray(karmaName,window.redbackModel.operatioNames)>=0;
|
return $.inArray(karmaName,window.redbackModel.operatioNames)>=0;
|
||||||
};
|
};
|
||||||
|
|
||||||
addValidationTokenHeader=function(user) {
|
addValidationTokenHeader = function (user) {
|
||||||
if(user) {
|
if (user) {
|
||||||
if (user.validationToken) {
|
if (user.validationToken) {
|
||||||
$.log("Adding validation token "+user.validationToken);
|
$.log("Adding validation token " + user.validationToken);
|
||||||
$.ajaxSetup({
|
$(document).ajaxSend(function (ev, xhr, settings) {
|
||||||
beforeSend: function (xhr) {
|
xhr.setRequestHeader('X-XSRF-TOKEN', user.validationToken);
|
||||||
xhr.setRequestHeader('X-XSRF-TOKEN', user.validationToken);
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
$.log("No validation token in user object "+user.username+", "+user.validationToken);
|
$.log("No validation token in user object " + user.username + ", " + user.validationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue