From: John 'Warthog9' Hawley Date: Thu, 24 Jun 2010 16:38:06 +0000 (-0700) Subject: templates: Add CSRF (cross-site request forgery) values to form posts X-Git-Url: https://git.ozlabs.org/?p=patchwork;a=commitdiff_plain;h=482ba5ac5e2fb71a8ae26ae9d5c5c72c33c35b23 templates: Add CSRF (cross-site request forgery) values to form posts This is a fairly simple patch, basically it does what the error message told me to do: "add In the template, there is a {% csrf_token %} template tag inside each POST form that targets an internal URL." Signed-off-by: John 'Warthog9' Hawley --- diff --git a/templates/patchwork/bundle.html b/templates/patchwork/bundle.html index 616a62e..a2933d5 100644 --- a/templates/patchwork/bundle.html +++ b/templates/patchwork/bundle.html @@ -26,6 +26,7 @@ project.

+ {% csrf_token %} diff --git a/templates/patchwork/bundles.html b/templates/patchwork/bundles.html index 95029c1..5340a64 100644 --- a/templates/patchwork/bundles.html +++ b/templates/patchwork/bundles.html @@ -33,6 +33,7 @@
+ {% csrf_token %} {{ bundle.delete_form.as_p }} + {% csrf_token %} @@ -44,6 +45,7 @@ {{createbundleform.errors}} {% endif %}
+ {% csrf_token %} {{ createbundleform.name }} @@ -55,6 +57,7 @@
Add to bundle: + {% csrf_token %} Archive: + {% csrf_token %} diff --git a/templates/patchwork/patch-list.html b/templates/patchwork/patch-list.html index bc9abe9..fe4d606 100644 --- a/templates/patchwork/patch-list.html +++ b/templates/patchwork/patch-list.html @@ -12,6 +12,7 @@ {% if order.editable %}
+ {% csrf_token %} @@ -33,6 +34,7 @@ {% endif %} +{% csrf_token %} diff --git a/templates/patchwork/patch.html b/templates/patchwork/patch.html index 7c249ec..c716a33 100644 --- a/templates/patchwork/patch.html +++ b/templates/patchwork/patch.html @@ -87,6 +87,7 @@ function toggle_headers(link_id, headers_id)

Patch Properties

+ {% csrf_token %}
@@ -130,6 +131,7 @@ function toggle_headers(link_id, headers_id)
Change state: + {% csrf_token %} @@ -143,6 +145,7 @@ function toggle_headers(link_id, headers_id)
{{createbundleform.non_field_errors}}
{% endif %}
+ {% csrf_token %} {% if createbundleform.name.errors %}
{{createbundleform.name.errors}}
@@ -157,6 +160,7 @@ function toggle_headers(link_id, headers_id)
Add to bundle: + {% csrf_token %} + {% csrf_token %} diff --git a/templates/patchwork/patchlist.html b/templates/patchwork/patchlist.html index 1bcd2c1..d6709cd 100644 --- a/templates/patchwork/patchlist.html +++ b/templates/patchwork/patchlist.html @@ -3,6 +3,7 @@ {% if patches %}
+{% csrf_token %} {% if patchform %} diff --git a/templates/patchwork/profile.html b/templates/patchwork/profile.html index c204183..e2d0b90 100644 --- a/templates/patchwork/profile.html +++ b/templates/patchwork/profile.html @@ -59,6 +59,7 @@ address.

{% ifnotequal user.email email.email %} + {% csrf_token %} {% endifnotequal %} @@ -68,6 +69,7 @@ address.

+ {% csrf_token %} {{ linkform.email }}
@@ -102,6 +104,7 @@ address.

Settings

+ {% csrf_token %} {{ profileform }} diff --git a/templates/patchwork/user-link.html b/templates/patchwork/user-link.html index 2ed193e..10c8ec2 100644 --- a/templates/patchwork/user-link.html +++ b/templates/patchwork/user-link.html @@ -22,6 +22,7 @@ you.

{% endif %} + {% csrf_token %} {{linkform.email.errors}} Link an email address: {{ linkform.email }} diff --git a/templates/registration/login.html b/templates/registration/login.html index eef56a4..2dfc2a7 100644 --- a/templates/registration/login.html +++ b/templates/registration/login.html @@ -6,6 +6,7 @@ {% block body %} +{% csrf_token %}
diff --git a/templates/registration/registration_form.html b/templates/registration/registration_form.html index 8938e40..e2b17c1 100644 --- a/templates/registration/registration_form.html +++ b/templates/registration/registration_form.html @@ -20,6 +20,7 @@
  • update the state of your own patches
  • +{% csrf_token %}
    login
    register