mirror of https://github.com/zulip/zulip.git
Revert "csrf: Improve API for when no CSRF input is available."
This reverts commit 9198fa4ec9
.
This commit is contained in:
parent
7d23076a0e
commit
6416737e70
|
@ -1,18 +1,9 @@
|
||||||
var csrf_token;
|
var csrf_token;
|
||||||
$(function () {
|
$(function () {
|
||||||
// This requires that we used Jinja2's {% csrf_input %} somewhere on the page.
|
// This requires that we used Jinja2's {% csrf_input %} somewhere on the page.
|
||||||
var csrf_input = $('input[name="csrfmiddlewaretoken"]');
|
csrf_token = $('input[name="csrfmiddlewaretoken"]').attr('value');
|
||||||
if (csrf_input.length > 0) {
|
|
||||||
csrf_token = csrf_input.attr('value');
|
|
||||||
} else {
|
|
||||||
csrf_token = undefined;
|
|
||||||
}
|
|
||||||
window.csrf_token = csrf_token;
|
window.csrf_token = csrf_token;
|
||||||
|
|
||||||
if (csrf_token === undefined) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$.ajaxSetup({
|
$.ajaxSetup({
|
||||||
beforeSend: function (xhr, settings) {
|
beforeSend: function (xhr, settings) {
|
||||||
if (!(/^http:.*/.test(settings.url) || /^https:.*/.test(settings.url))) {
|
if (!(/^http:.*/.test(settings.url) || /^https:.*/.test(settings.url))) {
|
||||||
|
|
Loading…
Reference in New Issue