Fixes U4-7459 XSRF protection bypass - ensures tokens are checked for the non-editor api controllers

This commit is contained in:
Shannon
2015-11-25 19:39:24 +01:00
parent 924a016ffe
commit 18c3345e47
9 changed files with 116 additions and 16 deletions

View File

@@ -357,4 +357,20 @@
});
//This sets the default jquery ajax headers to include our csrf token, we
// need to user the beforeSend method because our token changes per user/login so
// it cannot be static
$.ajaxSetup({
beforeSend: function (xhr) {
function getCookie(name) {
var value = "; " + document.cookie;
var parts = value.split("; " + name + "=");
if (parts.length === 2) return parts.pop().split(";").shift();
}
xhr.setRequestHeader("X-XSRF-TOKEN", getCookie("XSRF-TOKEN"));
}
});
})(jQuery);