Factor out forms + small changes
This commit is contained in:
parent
bf99e93cf1
commit
b41bbb4188
7 changed files with 38 additions and 40 deletions
|
@ -35,13 +35,12 @@ h2 {
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: https://git.eleves.ens.fr/klub-dev-ens/authens/issues/9 */
|
|
||||||
.oldcas {
|
.oldcas {
|
||||||
background: #CB6318;
|
background: #CB6318;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
form {
|
.auth_form {
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
@ -58,7 +57,7 @@ form {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
form table {
|
.auth_form table {
|
||||||
margin: 20px auto;
|
margin: 20px auto;
|
||||||
border-spacing: 0.3em;
|
border-spacing: 0.3em;
|
||||||
}
|
}
|
||||||
|
|
4
authens/templates/authens/auth_form_field.html
Normal file
4
authens/templates/authens/auth_form_field.html
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<tr>
|
||||||
|
<th>{{ field.label_tag }}</th>
|
||||||
|
<td>{{ field }}</td>
|
||||||
|
</tr>
|
4
authens/templates/authens/form_field_snippet.html
Normal file
4
authens/templates/authens/form_field_snippet.html
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<tr>
|
||||||
|
<th>{{ field.label_tag }}</th>
|
||||||
|
<td>{{ field }} {{ field.errors }}</td>
|
||||||
|
</tr>
|
8
authens/templates/authens/form_full_snippet.html
Normal file
8
authens/templates/authens/form_full_snippet.html
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
|
<form action="" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
{% include "authens/form_snippet.html" %}
|
||||||
|
|
||||||
|
<input type="submit" value="{% trans submit_text %}">
|
||||||
|
</form>
|
7
authens/templates/authens/form_snippet.html
Normal file
7
authens/templates/authens/form_snippet.html
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<table>
|
||||||
|
<tbody>
|
||||||
|
{% for field in form %}
|
||||||
|
{% include 'authens/form_field_snippet.html' with field=field %}
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
|
@ -4,24 +4,12 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>{% if request.site.name %}{{ request.site.name }}{% else %}AuthENS{% endif %} - {% trans "Connexion vieilleux" %}</h2>
|
<h2>{% if request.site.name %}{{ request.site.name }}{% else %}AuthENS{% endif %} - {% trans "Connexion vieilleux" %}</h2>
|
||||||
|
|
||||||
{% if form.errors %}
|
{% for error in form.non_field_errors %}
|
||||||
<p class="error">{% trans "Login CAS, promotion et/ou mot de passe incorrect" %}</p>
|
<p class="error">{{ error }}</p>
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<form class="oldcas" method="post" action="">
|
|
||||||
{% csrf_token %}
|
|
||||||
<table>
|
|
||||||
<tbody>
|
|
||||||
{% for field in form %}
|
|
||||||
<tr>
|
|
||||||
<th>{{ field.label_tag }}</th>
|
|
||||||
<td>{{ field }}</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
|
||||||
</table>
|
<div class=" auth_form oldcas">
|
||||||
<input type="submit" value="{% trans "Se connecter" %}">
|
{% include "authens/form_full_snippet.html" with submit_text="Se connecter" %}
|
||||||
<input type="hidden" name="next" value="{{ next }}">
|
</div>
|
||||||
</form>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -4,23 +4,11 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>{% if request.site.name %}{{ request.site.name }}{% else %}AuthENS{% endif %} - {% trans "Connexion par mot de passe" %}</h2>
|
<h2>{% if request.site.name %}{{ request.site.name }}{% else %}AuthENS{% endif %} - {% trans "Connexion par mot de passe" %}</h2>
|
||||||
|
|
||||||
{% if form.errors %}
|
{% for error in form.non_field_errors %}
|
||||||
<p class="error">{% trans "Nom d'utilisateur et/ou mot de passe incorrect" %}</p>
|
<p class="error">{{ error }}</p>
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<form class="exte" method="post" action="{% url 'authens:login.pwd' %}">
|
|
||||||
{% csrf_token %}
|
|
||||||
<table>
|
|
||||||
<tbody>
|
|
||||||
{% for field in form %}
|
|
||||||
<tr>
|
|
||||||
<th>{{ field.label_tag }}</th>
|
|
||||||
<td>{{ field }}</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
|
||||||
</table>
|
<div class=" auth_form exte">
|
||||||
<input type="submit" value="{% trans "Se connecter" %}">
|
{% include "authens/form_full_snippet.html" with submit_text="Se connecter" %}
|
||||||
<input type="hidden" name="next" value="{{ next }}">
|
</div>
|
||||||
</form>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
Loading…
Reference in a new issue