]> git.openstreetmap.org Git - osqa.git/commitdiff
enabling the CSRF protection middleware and adding the {% csrf_token %} tag to the...
authorjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Mon, 18 Apr 2011 17:28:53 +0000 (17:28 +0000)
committerjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Mon, 18 Apr 2011 17:28:53 +0000 (17:28 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@988 0cfe37f9-358a-4d5e-be75-b63607b5c754

29 files changed:
forum/skins/default/templates/answer_edit.html
forum/skins/default/templates/ask.html
forum/skins/default/templates/auth/auth_settings.html
forum/skins/default/templates/auth/complete.html
forum/skins/default/templates/auth/signin.html
forum/skins/default/templates/auth/temp_login_request.html
forum/skins/default/templates/close.html
forum/skins/default/templates/feedback.html
forum/skins/default/templates/header.html
forum/skins/default/templates/node/comments.html
forum/skins/default/templates/notarobot.html
forum/skins/default/templates/osqaadmin/createuser.html
forum/skins/default/templates/osqaadmin/edit_page.html
forum/skins/default/templates/osqaadmin/maintenance.html
forum/skins/default/templates/osqaadmin/moderation.html
forum/skins/default/templates/osqaadmin/nodeman.html
forum/skins/default/templates/osqaadmin/set.html
forum/skins/default/templates/question.html
forum/skins/default/templates/question_edit.html
forum/skins/default/templates/question_retag.html
forum/skins/default/templates/reopen.html
forum/skins/default/templates/search.html
forum/skins/default/templates/users/edit.html
forum/skins/default/templates/users/preferences.html
forum/skins/default/templates/users/subscriptions_settings.html
forum_modules/akismet/templates/foundspam.html
forum_modules/exporter/templates/exporter.html
forum_modules/sximporter/templates/page.html
settings.py

index 985adddc84829781f5f1babff6a8e92226ea7ef2..9409f0d8987b87ee223fe3a05e832e605ed2760f 100644 (file)
@@ -63,7 +63,8 @@
 </div>
 <div id="main-body" class="ask-body">
     <div id="askform">
-        <form id="fmedit" action="{% url edit_answer answer.id %}" method="post" >
+        <form id="fmedit" action="{% url edit_answer answer.id %}" method="post">
+            {% csrf_token %}
             <label for="id_revision" ><strong>{% trans "revision" %}:</strong></label> <br/> 
             {% if revision_form.revision.errors %}{{ revision_form.revision.errors.as_ul }}{% endif %}
             <div>
index 26f5fae95bd6264811f1317c66cc6650c5076f07..f2b5b5307620c1493bcaa6dafd16112928c9f89a 100644 (file)
@@ -94,6 +94,7 @@
 <div id="main-body" class="ask-body">
     <div id="askform">
         <form id="fmask" action="" method="post" accept-charset="utf-8">
+            {% csrf_token %}
                        {% if not request.user.is_authenticated %}
             <div class="message">
                 <span class="strong big">{% trans "You are welcome to start submitting your question anonymously." %}</span>
index 8b52019b2b24b80bce1487be226f70b277eaca68..969036d6c499650c900381ca809df8c95d6c6533 100644 (file)
@@ -27,6 +27,7 @@
 {% endif %}
 <div class="aligned">
        <form action="" method="post" accept-charset="utf-8">
+        {% csrf_token %}
         <ul id="changepw-form" class="form-horizontal-rows">
         {{form.as_ul}}
         </ul>
index 5b293ebe41b75c30ac7d1f265c9ee89bf030a21a..79f10dcf27bf9b1729dd33cdb48f392cf1e157c6 100644 (file)
@@ -34,6 +34,7 @@
 
        <div class="login">
         <form name="fregister" action="" method="POST">
+            {% csrf_token %}
             {{ form1.next }}
             <div class="form-row-vertical margin-bottom">
                 <label for="id_username">{{ form1.username.label }}</label>
@@ -81,6 +82,7 @@
     {% if form2 %}
        <div class="login" style="display:none">
         <form name="fverify" action="{% url user_register %}" method="POST">
+            {% csrf_token %}
             {{ form2.next }}
                        <fieldset style="padding:10px">
                                <legend class="big">{% trans "Existing account" %}</legend>
index 19dee071b37466f136979a0239005d148bd781a8..5514cc52823ecdaed5a8922a1d8574f62d39381f 100644 (file)
@@ -28,6 +28,7 @@
     {% endif %}\r
     {% for provider in top_stackitem_providers %}\r
         <form class="signin_form" method="POST" action="{% url auth_provider_signin provider=provider.id %}" accept-charset="utf-8">\r
+            {% csrf_token %}\r
             {% include provider.stack_item_template %}\r
             <input type="hidden" class="validate_email" name="validate_email" value="yes" />\r
         </form>\r
         {% endfor %}\r
     </div>\r
     <form name="signin_form" id="signin_form" class="signin_form" method="POST" action="">\r
+        {% csrf_token %}\r
         <div id="signin_form_slot"></div>\r
         <input type="hidden" class="validate_email" name="validate_email" value="yes" />\r
     </form>\r
     {% for provider in stackitem_providers %}\r
         <h3 class="or_label">{% trans 'Or...' %}</h3>\r
         <form class="signin_form" method="POST" action="{% url auth_provider_signin provider=provider.id %}" accept-charset="utf-8">\r
+            {% csrf_token %}\r
             {% include provider.stack_item_template %}\r
             <input type="hidden" class="validate_email" name="validate_email" value="yes" />\r
         </form>\r
     {% endfor %}\r
     <h3 class="or_label">{% trans 'Or...' %}</h3>\r
     <form name="signin_form" id="dummy_form_unused" class="signin_form" method="POST" action="">\r
+        {% csrf_token %}\r
         <fieldset>\r
             {% trans 'Click' %} <a href="{% url auth_request_tempsignin %}">{% trans 'here' %}</a> {% trans "if you're having trouble signing in." %}\r
         </fieldset>\r
index 772f18fb06b73f703d9c04381cdf9daecadd2be1..70f740e2d8e917318b6d380a893b6725571f8bcf 100644 (file)
@@ -19,6 +19,7 @@
         </ul>\r
        {% endif %}\r
        <form action="" method="post" accept-charset="utf-8">\r
+        {% csrf_token %}\r
         <ul id="changepw-form" class="form-horizontal-rows">\r
         {{form.as_ul}}\r
         </ul>\r
index d9e73507e37462010f8489c660b94bc0e34bc415..2e8af8d335da9b09b9b1aebd229dc690527de30c 100644 (file)
@@ -21,6 +21,7 @@
     </p>   
     
     <form id="fmclose" action="{% url close question.id %}" method="post" >
+        {% csrf_token %}
         <p>
             <strong>{% trans "Reasons" %}:</strong> {{ form.reason }}
         </p>
index 38bb48ff927fdaf07b46176fb562449c8fce2522..f4a4781a9374a4f047be2254347c7615f8ff9e25 100644 (file)
@@ -12,6 +12,7 @@
 </div>
 <div class="content">
     <form method="post" action="{% url feedback %}" accept-charset="utf-8">
+        {% csrf_token %}
         {% if user.is_authenticated %}
             <p class="message">
             {% blocktrans with user.username as user_name %}
index 0e2d28c6c2d36014f0aafd98be7519b516503249..0e3a73f7d0805b9ef9fc76770bf9fa60e9670149 100644 (file)
@@ -25,6 +25,7 @@
   
        <div id="searchBar">
     <form action="{% url search %}" method="get">
+        {% csrf_token %}
         <div>
             <input type="text" class="searchInput" value="{{ keywords }}" name="q" id="keywords" />
             <input type="submit" name="Submit" value="{% trans "search" %}" class="searchBtn" />
index 9105f56872df0122a63d69d86b326021495f3660..d4f9b6297f9b470851ab65e6dbec1806b166eae6 100644 (file)
@@ -48,6 +48,7 @@
 <div id="comment-{{ post.id }}-form-container" class="comment-form-container">\r
     {% if can_comment %}\r
     <form id="comment-{{ post.id }}-form" method="post" action="{% url comment id=post.id %}" accept-charset="utf-8">\r
+        {% csrf_token %}\r
         <div class="comment-form-widgets-container">\r
             <textarea name="comment" class="commentBox"></textarea>\r
             <div class="comment-form-buttons">\r
index 698c5696821e7bfcf0838a8816459ec58030917d..dae82b4a546cc821d53d415ac312fadf82fd7ee5 100644 (file)
@@ -4,6 +4,7 @@
 {% block content %}
 {% comment %} this form is set up to be used in wizards {% endcomment %}
 <form name="notarobot" action="." method="POST">
+    {% csrf_token %}
     <div>
     {{form}}
     </div>
index 4b0ed8cb94695c05ae08ae279ca29e8c01ddd71d..65c61b9103d1d2b563a807f5775679331cb1c17e 100644 (file)
@@ -12,6 +12,7 @@
 
 {% block admincontent %}
     <form action="" method="POST">
+        {% csrf_token %}
         <table>
             {{ form.as_table }}
             <tr><th></th><td><input type="submit" value="{% trans "Save" %}"></td></tr>
index d8d251ff405ec97c17253e81b9a71fb3643f3a43..ea7c0a98369ffc85bee30a45c145ebc9d7263974 100644 (file)
@@ -14,6 +14,7 @@
 
 {% block admincontent %}
     <form action="" method="post" accept-charset="utf-8">
+        {% csrf_token %}
         <table style="width: 100%">
         {{ form.as_table }}
         <tr>
index 38d1d0e2c4e7861cd9985d287b4d576849c6dd98..0e4a7320296e88161801d5d4bcca46ba4857aca3 100644 (file)
@@ -8,6 +8,7 @@
 
 {% block admincontent %}
 <form method="POST" action="">
+    {% csrf_token %}
     {% if in_maintenance %}
         <h1>{% trans "Your site is currently running on maintenance mode." %}</h1>
         <p>{% trans "You can adjust the settings bellow" %}</p>
index 688c897cf9198a500c3ecddb25d1945afc87004c..050f1f176aef861a6447a0c779fb091f48068243 100644 (file)
@@ -9,6 +9,7 @@
 {% block admincontent %}
     <div class="module">
         <form action="" id="changelist" method="POST">
+            {% csrf_token %}
             <div class="actions">
                 {% trans "Verify:" %}
                 <input type="text" size="3" name="limit" id="filter-limit" value="5" />
index 997fab57864b732991ccad268cbf9cd75cc6cdca..ea97d1207d1b9f459ddf883a1bb2edbe79dc7e05 100644 (file)
     <div id="changelist" class="module filtered">
         <div id="toolbar">
             <form method="get" action="" id="changelist-search">
+            {% csrf_token %}
             <div>
                 <div>
                     <label><img alt="Search" src="{{ settings.ADMIN_MEDIA_PREFIX }}img/admin/icon_searchbox.png"></label>
                 {% endfor %}
             </ul>
             <form action="" method="POST">
+                {% csrf_token %}
                 <input name="filter_name" type="text" size="20" id="filter-name-box" style="color: #AAA;" value="{% trans "Filter name..." %}" />
                 <button name="save_filter" value="0" style="color: #AAA;" title="{% trans "Click to save the current filter" %}" id="save-filter-button" disabled="disabled" class="button">{% trans "Save" %}</button>
             </form>
 
             {% comment %}<h3>{% trans "Show" %}</h3>
             <form action="" method="get">
+                {% csrf_token %}
                 <div>{{ show_form.show }}</div>
                 <input type="submit" value="{% trans "Refresh" %}" />
             </form>{% endcomment %}
             </div>
         </div>
         <form id="changelist-form" method="POST" action="">
+            {% csrf_token %}
             <div class="actions">
                 <label>
                     {% trans "Action" %}:
index 5cc427d366fd6ca7141a18487d3eabef12e32520..3128d79565acc87da7649332f291d1402a669f70 100644 (file)
@@ -8,6 +8,7 @@
 \r
 {% block admincontent %}\r
     <form action="" method="POST" enctype="multipart/form-data" accept-charset="utf-8">\r
+        {% csrf_token %}\r
         <table id="admin_form" style="width: 100%">\r
             {{ form.as_table }}\r
             <tr>\r
index c6c4cdeb136b4b277aa96c8d62329b8b2036eea8..9eff07c435daf41104fdc3d2d80ec49711381960 100644 (file)
                 </div>\r
             {% endif %}\r
         <form id="fmanswer" action="{% url answer question.id %}" method="post">\r
+            {% csrf_token %}\r
             <div style="clear:both">\r
             </div>\r
             \r
index 417707472819e3eb644fd3f43d213c93a2c7066e..4ee8060be967649b79f32a0e11165f7a78e2f81a 100644 (file)
@@ -92,7 +92,8 @@
 </div>
 <div id="main-body" class="ask-body">
     <div id="askform">
-        <form id="fmedit" action="" method="post" >
+        <form id="fmedit" action="" method="post">
+            {% csrf_token %}
             <label for="id_revision" ><strong>{% trans "revision" %}:</strong></label> <br/> 
             {% if revision_form.revision.errors %}{{ revision_form.revision.errors.as_ul }}{% endif %}
             <div style="vertical-align:middle">
index 9050e25ed21d4bf96be24aa98f742a8ea54f9cdc..f0da4ff1999e805ba6cf44ad35d0e0425b7d7b59 100644 (file)
@@ -59,7 +59,8 @@
 </div>
 <div id="main-body" class="ask-body">
     <div id="askform">
-        <form id="fmretag" action="{% url edit_question question.id %}" method="post" >
+        <form id="fmretag" action="{% url edit_question question.id %}" method="post">
+            {% csrf_token %}
             <h3>
                 {{ question.headline }}
             </h3>
index cd0c37bc50500b76a2db50f84e3a7de707e5215a..7de075ee14411f4b7df0c9ff643c2550d0ab9580 100644 (file)
         </strong>
     </p>
     
-    <form id="fmclose" action="{% url reopen question.id %}" method="post" >
-
+    <form id="fmclose" action="{% url reopen question.id %}" method="post">
+        {% csrf_token %}
         <div id="" style="padding:20px 0 20px 0">
             <input type="submit" value="{% trans "Reopen this question" %}" class="submit" />
             <input id="btBack" type="button" value="{% trans "Cancel" %}"  class="submit"  />
-            
         </div>
-        
     </form>
 </div>
 {% endblock %}
index e413abdeda5052732e4b887ca16e489292120ce7..05b9de6fad3fa018b2b204e51195094ad0cf065d 100644 (file)
@@ -10,6 +10,7 @@
 </div>
 <div id="main-body" style="text-align: center; height: 400px;">
 <form action="{% url search %}" method="get">
+    {% csrf_token %}
     <div>
         <input type="text" class="searchInput" value="{{ keywords }}" name="q" id="keywords" style="width: 600px" />
         <input type="submit" name="Submit" value="{% trans "search" %}" class="searchBtn" />
index 3240fd25f91efa91566249f26c0a30ca8d063371..09292fec448817918411ea7f040bc04902ab53c5 100644 (file)
@@ -34,6 +34,7 @@
 </div>\r
 <div id="main-body" style="width:100%;padding-top:10px">\r
     <form name="" action="{% url edit_user user.id %}" method="post">\r
+        {% csrf_token %}\r
         <div id="left" style="float:left;width:180px">\r
             {% if user.email %}\r
             {% gravatar user 128 %}\r
index f9393acac3e1c77112b3aabb91914f733e66fc9d..eb223d375bc4bcf400c531169b3dcdafd8e093d1 100644 (file)
@@ -6,6 +6,7 @@
     <h2>{% trans "Preferences" %}</h2>
     <div class='inline-block'>
     <form method="POST">
+        {% csrf_token %}
         <p class="message">
             {% trans "Here you can set some personal preferences." %}
         </p>
index 6232d135bacae4c98085fdc55bdfbb60be798b50..7675db3fde47b3a6e061f3aee472abeaf11443b9 100644 (file)
@@ -10,6 +10,7 @@
 </p>\r
 <div class='inline-block'>\r
 <form method="POST">\r
+    {% csrf_token %}\r
     {{ form.errors }}\r
     <table class="form-as-table">\r
         <tr>\r
index 77251c72de12238bd71075c17e3ae326d1f30eda..582d61526aa9b2a60b27ae8cb62678b3b4e7f249 100644 (file)
@@ -14,6 +14,7 @@ If you believe this is an error, please contact the forum administrator.
 
 {% if captcha_form.recaptcha %}
 <form action="." method="post">
+{% csrf_token %}
 <table>
        <tr>
                <td>
index 78c12c7b642d7c9959aa133ce40aabfa38f28e36..d3064805da89c0d0c77d493967dff2beffd741b7 100644 (file)
@@ -25,6 +25,7 @@
     <strong>{% trans "Start new backup" %}</strong>
 </p>
 <form method="POST" action="">
+    {% csrf_token %}
     <table>
     {{ form.as_table }}
     </table>
index 0011d1d81091471acab408b9198b91440d12453e..42de46d82e97dd1fa26eacb7810bc3a10c65d7e9 100644 (file)
@@ -12,6 +12,7 @@
 \r
 {% block admincontent %}\r
     <form method="post" action="" enctype="multipart/form-data">\r
+    {% csrf_token %}\r
     <input type="file" name="dump" /><br>\r
     {% trans "Your user id in stack exchange" %}\r
     <input type="test" name="owneruid" size="3" value="2" /><br />\r
index de55240cddc405043605566ad30ec53675b33c6c..83e59c31298672b372215f3f56557d0e6700e359 100644 (file)
@@ -15,6 +15,7 @@ TEMPLATE_LOADERS = [
 ]
 
 MIDDLEWARE_CLASSES = [
+    'django.middleware.csrf.CsrfViewMiddleware',
     'django.contrib.sessions.middleware.SessionMiddleware',
     'django.middleware.common.CommonMiddleware',
     'forum.middleware.extended_user.ExtendedUser',