From: jordan Date: Tue, 22 May 2012 15:15:56 +0000 (+0000) Subject: accept only POST requests for vote_post command, make the ajax command send only... X-Git-Tag: live~50 X-Git-Url: https://git.openstreetmap.org./osqa.git/commitdiff_plain/f2f41b2266cce4fdadccf7f444ddf25aa99caffa accept only POST requests for vote_post command, make the ajax command send only POST requests git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@1267 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- diff --git a/forum/skins/default/media/js/osqa.main.js b/forum/skins/default/media/js/osqa.main.js index 2cae49e..1595df7 100644 --- a/forum/skins/default/media/js/osqa.main.js +++ b/forum/skins/default/media/js/osqa.main.js @@ -443,8 +443,14 @@ $(function() { var $dialog = show_dialog(doptions); } else { start_command(); - $.getJSON(ajax_url, function(data) { - process_ajax_response(data, evt); + $.ajax({ + url: ajax_url, + type: "POST", + dataType: "json", + contentType: "application/json; charset=utf-8", + success: function(data) { + process_ajax_response(data, evt); + } }); } diff --git a/forum/views/commands.py b/forum/views/commands.py index 51499a9..5271eec 100644 --- a/forum/views/commands.py +++ b/forum/views/commands.py @@ -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"))