]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/leaflet.share.js
Merge remote-tracking branch 'upstream/pull/5774'
[rails.git] / app / assets / javascripts / leaflet.share.js
index 9f774df7d64c878c26dd10d72957a1e3161f2cbf..d84f8820e3e0a37966470cc8ac43c88bf9dabd1f 100644 (file)
@@ -228,13 +228,11 @@ L.OSM.share = function (options) {
         .appendTo($form);
     }
 
-    const csrf_param = $("meta[name=csrf-param]").attr("content"),
-          csrf_token = $("meta[name=csrf-token]").attr("content");
+    const csrfAttrs = { type: "hidden" };
+    [[csrfAttrs.name, csrfAttrs.value]] = Object.entries(OSM.csrf);
 
     $("<input>")
-      .attr("name", csrf_param)
-      .attr("value", csrf_token)
-      .attr("type", "hidden")
+      .attr(csrfAttrs)
       .appendTo($form);
 
     const args = {