]> git.openstreetmap.org Git - osqa.git/commitdiff
accept only POST requests for vote_post command, make the ajax command send only...
authorjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Tue, 22 May 2012 15:15:56 +0000 (15:15 +0000)
committerjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Tue, 22 May 2012 15:15:56 +0000 (15:15 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1267 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/skins/default/media/js/osqa.main.js
forum/views/commands.py

index 2cae49e8f7ce9c6cde45960692ba267fd96c2291..1595df74bdfc14502a212e125749f71165e050d7 100644 (file)
@@ -443,8 +443,14 @@ $(function() {
             var $dialog = show_dialog(doptions);\r
         } else {\r
             start_command();\r
-            $.getJSON(ajax_url, function(data) {\r
-                process_ajax_response(data, evt);\r
+            $.ajax({\r
+                url: ajax_url,\r
+                type: "POST",\r
+                dataType: "json",\r
+                contentType: "application/json; charset=utf-8",\r
+                success: function(data) {\r
+                    process_ajax_response(data, evt);\r
+                }\r
             });\r
         }\r
 \r
index 51499a9fb26a9633955c71cb213f1f4e1b950e10..5271eec69d014aaf0591120096aa40ab67a29a1f 100644 (file)
@@ -75,7 +75,7 @@ class CannotDoubleActionException(CommandException):
 
 @decorate.withfn(command)
 def vote_post(request, id, vote_type):
-    if not request.is_ajax():
+    if not request.method == 'POST':
         raise CommandException(_("Invalid request"))