|
|
@@ -181,13 +181,12 @@ from django.utils.translation import ugettext as _
|
|
|
// these HTTP methods do not require CSRF protection
|
|
|
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
|
|
|
}
|
|
|
- $.ajaxSetup({
|
|
|
- beforeSend: function(xhr, settings) {
|
|
|
- if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
|
|
|
- xhr.setRequestHeader("X-CSRFToken", csrftoken);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
+
|
|
|
+ var xrhsend = XMLHttpRequest.prototype.send;
|
|
|
+ XMLHttpRequest.prototype.send = function(data) {
|
|
|
+ this.setRequestHeader('X-CSRFToken', csrftoken);
|
|
|
+ return xrhsend.apply(this, arguments);
|
|
|
+ }
|
|
|
/////
|
|
|
|
|
|
// prevents framebusting and clickjacking
|