aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/components/utils.jsx.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/src/js/components/utils.jsx.js')
-rw-r--r--web/src/js/components/utils.jsx.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/web/src/js/components/utils.jsx.js b/web/src/js/components/utils.jsx.js
index b1d9a006..12775adc 100644
--- a/web/src/js/components/utils.jsx.js
+++ b/web/src/js/components/utils.jsx.js
@@ -95,4 +95,21 @@ var Splitter = React.createClass({
</div>
);
}
+});
+
+function getCookie(name) {
+ var r = document.cookie.match("\\b" + name + "=([^;]*)\\b");
+ return r ? r[1] : undefined;
+}
+var xsrf = $.param({_xsrf: getCookie("_xsrf")});
+
+//Tornado XSRF Protection.
+$.ajaxPrefilter(function(options){
+ if(options.type === "post" && options.url[0] === "/"){
+ if(options.data){
+ options.data += ("&" + xsrf);
+ } else {
+ options.data = xsrf;
+ }
+ }
}); \ No newline at end of file