8000 [1.5.x] Fixed #22859 -- Improved crossDomain technique in CSRF example. · alex-python/django@ce06ef5 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit ce06ef5

Browse files
committed
[1.5.x] Fixed #22859 -- Improved crossDomain technique in CSRF example.
Thanks flisky for the report. Backport of 0be4d64 from master
1 parent 7342784 commit ce06ef5

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

docs/ref/contrib/csrf.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,8 @@ jQuery 1.5 and newer in order to replace the ``sameOrigin`` logic above:
190190
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
191191
}
192192
$.ajaxSetup({
193-
crossDomain: false, // obviates need for sameOrigin test
194193
beforeSend: function(xhr, settings) {
195-
if (!csrfSafeMethod(settings.type)) {
194+
if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
196195
xhr.setRequestHeader("X-CSRFToken", csrftoken);
197196
}
198197
}

0 commit comments

Comments
 (0)
0