CSRF updates for Django 1.1+. Thanks to 'litchfield4' for the patch.

This commit is contained in:
Ross Poulton 2010-07-16 07:53:43 +00:00
parent 8fb32a33bc
commit 1db70b2804
16 changed files with 23 additions and 20 deletions

View File

@ -53,3 +53,6 @@ set incorrectly. Thanks to Lukeman for the fix.
2010-07-16 r157 Fix issues #141, #142 - IMAP infinite loops and ticket
pagination issues. Thanks to Walter Doekes for the patches.
2010-07-16 r158 New CSRF functionality for Django 1.1+. Thanks to
'litchfield4' for the patch.

View File

@ -21,7 +21,7 @@
<li><a href='{% url helpdesk_submit %}'>{% trans "New Ticket" %}</a></li>
<li><a href='{% url helpdesk_report_index %}'>{% trans "Stats" %}</a></li>
<li><a href='{% url logout %}'>{% trans "Logout" %}</a></li>
{% if not query %}<li><form id='searchform' method='get' action='{% url helpdesk_list %}'><input type='text' name='q' size='10' class='input' value='{% trans "Search..." %}' id='search_query' onFocus='s=document.getElementById("search_query");if (s.value == "{% trans "Search..." %}") { s.value = ""; }' title='{% trans "Enter a keyword, or a ticket number to jump straight to that ticket." %}'/><input type='hidden' name='status' value='1' /><input type='hidden' name='status' value='2' /><input type='hidden' name='status' value='3' /><input type='hidden' name='search_type' value='header' /></form></li>{% endif %}
{% if not query %}<li><form id='searchform' method='get' action='{% url helpdesk_list %}'><input type='text' name='q' size='10' class='input' value='{% trans "Search..." %}' id='search_query' onFocus='s=document.getElementById("search_query");if (s.value == "{% trans "Search..." %}") { s.value = ""; }' title='{% trans "Enter a keyword, or a ticket number to jump straight to that ticket." %}'/><input type='hidden' name='status' value='1' /><input type='hidden' name='status' value='2' /><input type='hidden' name='status' value='3' /><input type='hidden' name='search_type' value='header' />{% csrf_token %}</form></li>{% endif %}
</ul>
</div>
<div id='body'>

View File

@ -14,5 +14,5 @@
{% blocktrans %}<p><a href='../'>No, Don't Delete It</a></p>
<form method='post' action='./'><input type='submit' value='Yes - Delete It' /></form>
<form method='post' action='./'><input type='submit' value='Yes - Delete It' />{% csrf_token %}</form>
{% endblocktrans %}{% endblock %}

View File

@ -27,5 +27,5 @@
</div>
</fieldset>
</form>
{% csrf_token %}</form>
{% endblock %}

View File

@ -10,5 +10,5 @@
{% blocktrans %}<p><a href='../'>No, Don't Delete It</a></p>
<form method='post' action='./'><input type='submit' value='Yes - Delete It' /></form>
<form method='post' action='./'><input type='submit' value='Yes - Delete It' />{% csrf_token %}</form>
{% endblocktrans %}{% endblock %}

View File

@ -29,5 +29,5 @@
</div>
</fieldset>
</form>
{% csrf_token %}</form>
{% endblock %}

View File

@ -22,6 +22,6 @@
<input type='submit' value='{% trans "Ignore E-Mail Address" %}' />
</form>
{% csrf_token %}</form>
{% endblock %}

View File

@ -10,5 +10,5 @@
{% blocktrans %}<p><a href='../../'>Keep Ignoring It</a></p>
<form method='post' action='./'><input type='submit' value='Stop Ignoring It' /></form>
<form method='post' action='./'><input type='submit' value='Stop Ignoring It' />{% csrf_token %}</form>
{% endblocktrans %}{% endblock %}

View File

@ -15,7 +15,7 @@
<input type='submit' value='{% trans "View Ticket" %}' />
</fieldset>
</form>
{% csrf_token %}</form>
<h2 name='submit'>{% trans "Submit a Ticket" %}</h2>
@ -41,5 +41,5 @@
</div>
</fieldset>
</form>
{% csrf_token %}</form>
{% endblock %}

View File

@ -18,7 +18,7 @@
<input type='submit' value='{% trans "View Ticket" %}' />
</fieldset>
</form>
{% csrf_token %}</form>
{% endblock %}

View File

@ -194,7 +194,7 @@
<input type='submit' value='{% trans "Update This Ticket" %}' />
</form>
{% csrf_token %}</form>
{% endblock %}

View File

@ -20,6 +20,6 @@
<input type='submit' value='{% trans "Save Ticket CC" %}' />
</form>
{% csrf_token %}</form>
{% endblock %}

View File

@ -10,5 +10,5 @@
{% blocktrans %}<p><a href='../../'>Don't Delete</a></p>
<form method='post' action='./'><input type='submit' value='Yes, Delete' /></form>
<form method='post' action='./'><input type='submit' value='Yes, Delete' />{% csrf_token %}</form>
{% endblocktrans %}{% endblock %}

View File

@ -59,7 +59,7 @@ $(document).ready(function() {
{% endif %}
</select>
<input type='button' id='filterBuilderButton' value='+' />
</form>
{% csrf_token %}</form>
<form method='get' action='./'>
<div class='filterBox{% if query_params.sorting %} filterBoxShow{% endif %}' id='filterBoxSort'>
@ -130,7 +130,7 @@ $(document).ready(function() {
</div>
<hr style='clear: both;' />
<input type='submit' value='{% trans "Apply Filter" %}' />
</form>
{% csrf_token %}</form>
</div>
{% if not from_saved_query %}
@ -153,7 +153,7 @@ $(document).ready(function() {
<input type='submit' value='{% trans "Save Query" %}'>
</div>
</form>
{% csrf_token %}</form>
</div>{% endif %}
<div id='tabload'>
@ -165,7 +165,7 @@ $(document).ready(function() {
{% endfor %}
</select></p>
<input type='submit' value='{% trans "Run Query" %}'>
</form>
{% csrf_token %}</form>
</div>
</div>
@ -216,5 +216,5 @@ $(document).ready(function() {
<p><label>Select: </label> <a href='#select_all' id='select_all'>All</a> <a href='#select_none' id='select_none'>None</a> <a href='#select_inverse' id='select_inverse'>Inverse</a></p>
<p><label for='id_mass_action'>With Selected Tickets:</label> <select name='action' id='id_mass_action'><option value='take'>Take (Assign to me)</option><option value='delete'>Delete</option><optgroup label='Close'><option value='close'>Close (Don't Send E-Mail)</option><option value='close_public'>Close (Send E-Mail)</option></optgroup><optgroup label='Assign To'><option value='unassign'>Nobody (Unassign)</option>{% for u in user_choices %}<option value='assign_{{ u.id }}'>{{ u.username }}</option>{% endfor %}</optgroup></select> <input type='submit' value='Go' /></p>
</form>
{% csrf_token %}</form>
{% endblock %}

View File

@ -17,6 +17,6 @@
{% endfor %}</dl>
</fieldset>
<input type='submit' value='{% trans "Save Options" %}' />
</form>
{% csrf_token %}</form>
{% endblock %}

View File

@ -16,5 +16,5 @@
</dl>
<input type='submit' value='{% trans "Login" %}' />
<input type="hidden" name="next" value="{% if next %}{{ next }}{% else %}../{% endif %}" />
</form>
{% csrf_token %}</form>
{% endblock %}