From 36c8275f5efd1584d9029cdb481c375395f6739d Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 20 Dec 2017 20:07:57 +0100 Subject: [PATCH] Fix #1061 --- public/js/ff/accounts/show.js | 2 +- public/js/ff/budgets/index.js | 2 +- public/js/ff/export/index.js | 1 + public/js/ff/help.js | 2 +- public/js/ff/piggy-banks/index.js | 2 +- public/js/ff/rules/index.js | 4 ++-- public/js/ff/search/index.js | 2 +- public/js/ff/transactions/list.js | 2 +- 8 files changed, 9 insertions(+), 8 deletions(-) diff --git a/public/js/ff/accounts/show.js b/public/js/ff/accounts/show.js index 3a3492d6ee..3b1ca6ce87 100644 --- a/public/js/ff/accounts/show.js +++ b/public/js/ff/accounts/show.js @@ -96,7 +96,7 @@ function sortStop(event, ui) { }); // do extra animation when done? - $.post('transactions/reorder', {items: submit, date: thisDate}); + $.post('transactions/reorder', {items: submit, date: thisDate, _token: token}); current.animate({backgroundColor: "#5cb85c"}, 200, function () { $(this).animate({backgroundColor: originalBG}, 200); diff --git a/public/js/ff/budgets/index.js b/public/js/ff/budgets/index.js index a9450a77dc..db07e9088d 100644 --- a/public/js/ff/budgets/index.js +++ b/public/js/ff/budgets/index.js @@ -120,7 +120,7 @@ function updateBudgetedAmounts(e) { // send a post to Firefly to update the amount: var newUri = budgetAmountUri.replace("REPLACE", id); - $.post(newUri, {amount: value, start: periodStart, end: periodEnd}).done(function (data) { + $.post(newUri, {amount: value, start: periodStart, end: periodEnd, _token: token}).done(function (data) { // difference between new value and original value var difference = value - original; diff --git a/public/js/ff/export/index.js b/public/js/ff/export/index.js index c4974d4f79..62a6da390e 100644 --- a/public/js/ff/export/index.js +++ b/public/js/ff/export/index.js @@ -95,6 +95,7 @@ function showError(text) { function callExport() { "use strict"; var data = $('#export').serialize(); + data['_token'] = token; // call status, keep calling it until response is "finished"? intervalId = window.setInterval(checkStatus, 500); diff --git a/public/js/ff/help.js b/public/js/ff/help.js index c8c34b6c2c..9894563e66 100644 --- a/public/js/ff/help.js +++ b/public/js/ff/help.js @@ -50,7 +50,7 @@ function showHelp(e) { } function enableGuidance(route, specialPage) { - $.post('json/intro/enable/' + route + '/' + specialPage).done(function (data) { + $.post('json/intro/enable/' + route + '/' + specialPage, {_token: token}).done(function (data) { alert(data.message); }).fail(function () { alert('Could not re-enable introduction.'); diff --git a/public/js/ff/piggy-banks/index.js b/public/js/ff/piggy-banks/index.js index dc89b4373d..72f128a2a0 100644 --- a/public/js/ff/piggy-banks/index.js +++ b/public/js/ff/piggy-banks/index.js @@ -89,7 +89,7 @@ function stopSorting() { var id = holder.data('id'); order.push(id); }); - $.post('piggy-banks/sort', {order: order}).done(function () { + $.post('piggy-banks/sort', {order: order, _token: token}).done(function () { $('.loadSpin').removeClass('fa fa-refresh fa-spin'); }); } \ No newline at end of file diff --git a/public/js/ff/rules/index.js b/public/js/ff/rules/index.js index 3dd009a638..5c58468fa1 100644 --- a/public/js/ff/rules/index.js +++ b/public/js/ff/rules/index.js @@ -115,11 +115,11 @@ function sortStop(event, ui) { }); if (parent.hasClass('rule-triggers')) { - $.post('rules/trigger/order/' + ruleId, {triggers: entries}).fail(function () { + $.post('rules/trigger/order/' + ruleId, {triggers: entries, _token: token}).fail(function () { alert('Could not re-order rule triggers. Please refresh the page.'); }); } else { - $.post('rules/action/order/' + ruleId, {actions: entries}).fail(function () { + $.post('rules/action/order/' + ruleId, {actions: entries, _token: token}).fail(function () { alert('Could not re-order rule actions. Please refresh the page.'); }); diff --git a/public/js/ff/search/index.js b/public/js/ff/search/index.js index c48d1815b0..8b8cea4304 100644 --- a/public/js/ff/search/index.js +++ b/public/js/ff/search/index.js @@ -29,7 +29,7 @@ $(function () { }); function startSearch(query) { - $.post(searchUri, {query: query}).done(presentSearchResults).fail(searchFailure); + $.post(searchUri, {query: query, _token: token}).done(presentSearchResults).fail(searchFailure); } function searchFailure() { diff --git a/public/js/ff/transactions/list.js b/public/js/ff/transactions/list.js index 50fb790d86..1a9b5d1230 100644 --- a/public/js/ff/transactions/list.js +++ b/public/js/ff/transactions/list.js @@ -71,7 +71,7 @@ function goToReconcile() { baseHref = bases[0].href; } - $.post(baseHref + 'transactions/reconcile', {transactions: ids}).done(function () { + $.post(baseHref + 'transactions/reconcile', {transactions: ids, _token: token}).done(function () { window.location.reload(true); }).fail(function () { alert('Could not reconcile transactions: please check the logs and try again later.');