Add CSRF protection to registration form (and remove annoying second

password)
This commit is contained in:
Wookey
2013-07-02 18:10:45 +01:00
parent ca1a1dfb97
commit ed13cca261
3 changed files with 19 additions and 22 deletions

View File

@@ -9,7 +9,7 @@ registration_form.html | {{ block.super }}
{% endblock %}
{% block content %}
<form action="{% url registration_register %}" method="POST">
<form action="{% url registration_register %}" method="POST">{% csrf_token %}
{% for error in form.non_field_errors %}
<span style="color:red">{{ error }}</span>
{% endfor %}
@@ -41,15 +41,6 @@ registration_form.html | {{ block.super }}
{% endfor %}
</td>
</tr>
<tr>
<td align="right" valign="top">Password (again):</td>
<td>
{{ form.password2 }} <br/>
{% for error in form.password2.errors %}
<span style="color:red">{{ error }}</span>
{% endfor %}
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" value="Register" /></td>