fix csrf token showing

This commit is contained in:
Jack Eilles 2023-12-26 19:26:19 +00:00
parent 40ab9fdbb1
commit 66d57eeab7
2 changed files with 74 additions and 27 deletions

View file

@ -3,19 +3,31 @@
{% block content %}
<h1>Login</h1>
<form action="" method="post">
{{ form.hidden_tag() }}
{% for field in form %}
{{ form.csrf_token() }}
<p>
{{ field.label }}<br>
{{ field() }}
{% if field.errors %}
<ul class=errors>
{% for category, message in messages %}
<li class="{{ category }}">{{ message }}</li>
{{ form.username.label }}<br>
{{ form.username() }}
{% if form.username.errors %}
<ul class="errors">
{% for error in form.username.errors %}
<li class="danger">{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
</p>
<p>
{{ form.password.label }}<br>
{{ form.password() }}
{% if form.password.errors %}
<ul class="errors">
{% for error in form.password.errors %}
<li class="danger">{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
</p>
<p>
<input type="submit" value="Login">
</p>
</form>
{% endblock %}

View file

@ -3,19 +3,54 @@
{% block content %}
<h1>Register</h1>
<form action="" method="post">
{{ form.hidden_tag() }}
{% for field in form %}
{{ form.csrf_token }}
<p>
{{ field.label }}<br>
{{ field() }}
{% if field.errors %}
<ul class=errors>
{% for error in field.errors %}
<li>{{ error }}</li>
{{ form.username.label }}
{{ form.username() }}
{% if form.username.errors %}
<ul class="errors">
{% for error in form.username.errors %}
<li class="danger">{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
</p>
<p>
{{ form.password.label }}
{{ form.password() }}
{% if form.password.errors %}
<ul class="errors">
{% for error in form.password.errors %}
<li class="danger">{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
</p>
<p>
{{ form.password2.label }}
{{ form.password2() }}
{% if form.password2.errors %}
<ul class="errors">
{% for error in form.password2.errors %}
<li class="danger">{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
</p>
<p>
{{ form.tnc.label }}
{{ form.tnc() }}
{% if form.tnc.errors %}
<ul class="errors">
{% for error in form.tnc.errors %}
<li class="danger">{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
</p>
<p>
<input type="submit" value="Register">
</p>
</form>
{% endblock %}