Refactor user registration and login forms for improved structure and error handling
This commit is contained in:
parent
7259046916
commit
a24fb897a3
2 changed files with 28 additions and 7 deletions
|
@ -2,5 +2,5 @@
|
|||
{% load form %}
|
||||
{% block content %}
|
||||
<h1>Créer un compte</h1>
|
||||
{% form form %}
|
||||
{% form form submit="Créer mon compte" %}
|
||||
{% endblock content %}
|
||||
|
|
|
@ -1,9 +1,30 @@
|
|||
{% extends "base.html" %}
|
||||
{% load form %}
|
||||
{% block content %}
|
||||
<h1>Connexion</h1>
|
||||
<p>
|
||||
<a href="{% url "signup" %}">Créer un compte</a>
|
||||
</p>
|
||||
{% form form submit="Se connecter" %}
|
||||
{% endblock content %}
|
||||
{% for error in form.non_field_errors %}<article class="message error">{{ error }}</article>{% endfor %}
|
||||
<form method="post" {% if action %}action="{% url action %}"{% endif %}>
|
||||
{% csrf_token %}
|
||||
{% for field in form %}
|
||||
<fieldset>
|
||||
{% if field.id_for_label %}
|
||||
<label for="{{ field.id_for_label }}">{{ field.label }}</label>
|
||||
{% else %}
|
||||
<legend>{{ field.label }}</legend>
|
||||
{% endif %}
|
||||
{{ field }}
|
||||
{% if field.errors %}
|
||||
<small id="{{ field.errors.field_id }}_error" class="form-error">{{ field.errors|join:", " }}</small>
|
||||
{% endif %}
|
||||
</fieldset>
|
||||
{% endfor %}
|
||||
<button type="submit">Me connecter</button>
|
||||
<p>
|
||||
<a href="{% url "signup" %}" role="button" class="secondary">Créer mon compte</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="{% url "password_reset" %}"
|
||||
role="button"
|
||||
class="outline secondary">J'ai oublié mon mot de passe</a>
|
||||
</p>
|
||||
</form>
|
||||
{% endblock content %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue