]> git.openstreetmap.org Git - rails.git/commitdiff
Make export form send authenticity token
authorTom Hughes <tom@compton.nu>
Mon, 2 Jan 2017 22:50:59 +0000 (22:50 +0000)
committerTom Hughes <tom@compton.nu>
Mon, 2 Jan 2017 22:50:59 +0000 (22:50 +0000)
app/assets/javascripts/leaflet.share.js

index a6b10821e868bc603da0b1d4e0bff296cf945818..7cfd50c8e23e09eb7fcc550ca159797e92a797d3 100644 (file)
@@ -213,6 +213,15 @@ L.OSM.share = function (options) {
       .attr('type', 'hidden')
       .appendTo($form);
 
+    var csrf_param = $("meta[name=csrf-param]").attr("content"),
+        csrf_token = $("meta[name=csrf-token]").attr("content");
+
+    $('<input>')
+      .attr('name', csrf_param)
+      .attr('value', csrf_token)
+      .attr('type', 'hidden')
+      .appendTo($form);
+
     $('<p>')
       .attr('class', 'deemphasize')
       .html(I18n.t('javascripts.share.image_size') + ' <span id="mapnik_image_width"></span> x <span id="mapnik_image_height"></span>')