On branche authens

This commit is contained in:
Tom Hubrecht 2021-01-26 14:26:35 +01:00
parent c70fcefa86
commit 6a59163dea
12 changed files with 280 additions and 66 deletions

View file

@ -0,0 +1,53 @@
{% extends "base.html" %}
{% load i18n %}
{% block auth %}{% endblock %}
{% block content %}
<h1 class="title">{% trans "Choisissez la méthode de connexion" %}</h1>
<hr>
{# Indications de connexion #}
{% comment %}
{% if method %}
<div class="message is-warning">
<div class="message-body">
{% if method == "PWD" %}
{% trans "Pour voter lors de cette élection, vous devez vous connecter à l'aide des identifiants reçus par mail. Choisissez la connexion par mot de passe." %}
{% elif method == "CAS" %}
{% trans "Pour voter lors de cette élection, vous devez vous connecter à l'aide du CAS élève." %}
{% endif %}
</div>
</div>
{% endif %}
{% endcomment %}
<div class="tile is-ancestor">
<div class="tile is-parent">
<a class="tile is-child notification is-primary" href="{% url "authens:login.cas" %}?next={{ next }}">
<div class="subtitle has-text-centered mb-2">
<span class="icon has-text-white">
<i class="fas fa-school"></i>
</span>
<span class="ml-3">{% trans "Connexion via CAS" %}</span>
</div>
</a>
</div>
<div class="tile is-parent">
<a class="tile is-child notification" href="{% url "authens:login.pwd" %}?next={{ next }}">
<div class="subtitle has-text-centered mb-2">
<span class="icon">
<i class="fas fa-key"></i>
</span>
<span class="ml-3">{% trans "Connexion par mot de passe" %}</span>
</div>
</a>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,56 @@
{% extends "base.html" %}
{% load i18n %}
{% block auth %}{% endblock %}
{% block content %}
<h1 class="title">{% trans "Connexion par mot de passe" %}</h1>
<hr>
<div class="columns is-centered">
<div class="column is-two-thirds">
<form action="" method="post">
{% csrf_token %}
{% include "forms/form.html" with errors=True %}
<div class="field is-grouped is-centered">
<div class="control is-expanded">
<button class="button is-fullwidth is-outlined is-primary is-light">
<span class="icon is-small">
<i class="fas fa-check"></i>
</span>
<span>{% trans "Enregistrer" %}</span>
</button>
</div>
<div class="control">
<a class="button is-primary" href="{% url 'authens:login' %}?next={{ next }}">
<span class="icon is-small">
<i class="fas fa-undo-alt"></i>
</span>
<span>{% trans "Retour" %}</span>
</a>
</div>
</div>
<div class="field is-centered">
<div class="control">
<div class="help has-text-centered">
<span>{% trans "Mot de passe oublié :" %}</span>
<a class="tag has-text-primary" href="{% url 'authens:reset.pwd' %}">
<span>{% trans "Réinitialiser mon mot de passe." %}</span>
<span class="icon is-small">
<i class="fas fa-lock-open"></i>
</span>
</a>
</div>
</div>
</div>
</form>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,42 @@
{% extends "base.html" %}
{% load i18n %}
{% block auth %}{% endblock %}
{% block content %}
<h1 class="title">{% trans "Réinitialisation du mot de passe" %}</h1>
<hr>
<div class="columns is-centered">
<div class="column is-two-thirds">
<form action="" method="post">
{% csrf_token %}
{% include "forms/form.html" with errors=True %}
<div class="field is-grouped is-centered">
<div class="control is-expanded">
<button class="button is-fullwidth is-outlined is-primary is-light">
<span class="icon is-small">
<i class="fas fa-check"></i>
</span>
<span>{% trans "Envoyer un mail" %}</span>
</button>
</div>
<div class="control">
<a class="button is-primary" href="{% url 'authens:login.pwd' %}?next={{ next }}">
<span class="icon is-small">
<i class="fas fa-undo-alt"></i>
</span>
<span>{% trans "Retour" %}</span>
</a>
</div>
</div>
</form>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,33 @@
{% extends "base.html" %}
{% load i18n %}
{% block auth %}{% endblock %}
{% block content %}
<h1 class="title">{% trans "Réinitialisation du mot de passe" %}</h1>
<hr>
<div class="columns is-centered">
<div class="column is-two-thirds">
<form action="" method="post">
{% csrf_token %}
{% include "forms/form.html" with errors=True %}
<div class="field is-grouped is-centered">
<div class="control is-expanded">
<button class="button is-fullwidth is-outlined is-primary is-light">
<span class="icon is-small">
<i class="fas fa-check"></i>
</span>
<span>{% trans "Enregistrer" %}</span>
</button>
</div>
</div>
</form>
</div>
</div>
{% endblock %}

View file

@ -55,22 +55,19 @@
</div>
<div class="level-item ml-3">
<a class="icon is-size-1 has-text-white" href="{% url 'auth.logout' %}?next={% if view.get_next_url %}{{ view.get_next_url }}{% else %}/{% endif %}">
<a class="icon is-size-1 has-text-white" href="{% url 'authens:logout' %}?next={% if view.get_next_url %}{{ view.get_next_url }}{% else %}/{% endif %}">
<i class="fas fa-sign-out-alt"></i>
</a>
</div>
{% else %}
<div class="level-item">
{% if election %}
<a class="icon is-size-1 has-text-white" href="{% url 'auth.select' %}?next={{ request.path }}&election_id={{ election.id }}&method={{ election.preferred_method }}">
<i class="fas fa-sign-in-alt"></i>
<a class="tag has-text-primary is-size-5" href="{% url 'authens:login' %}?next={{ request.path }}">
<span>{% trans "Se connecter" %}</span>
<span class="icon">
<i class="fas fa-sign-in-alt"></i>
</span>
</a>
{% else %}
<a class="icon is-size-1 has-text-white" href="{% url 'auth.cas' %}?next={{ request.path }}">
<i class="fas fa-sign-in-alt"></i>
</a>
{% endif %}
</div>
{% endif %}
</div>

View file

@ -12,8 +12,8 @@
{% endfor %}
{% if field.help_text %}
<p class="help">
<div class="help">
{{ field.help_text|safe }}
</p>
</div>
{% endif %}
</div>

View file

@ -0,0 +1,42 @@
{% extends "base.html" %}
{% load i18n %}
{% block auth %}{% endblock %}
{% block content %}
<h1 class="title">{% trans "Déconnexion réussie" %}</h1>
<hr>
<div class="columns is-centered">
<div class="column is-two-thirds">
<form action="" method="post">
{% csrf_token %}
{% include "forms/form.html" with errors=True %}
<div class="field is-grouped is-centered">
<div class="control is-expanded">
<a class="button is-fullwidth is-outlined is-primary is-light" href="{% url 'authens:login' %}">
<span>{% trans "Se reconnecter" %}</span>
<span class="icon is-small">
<i class="fas fa-unlock"></i>
</span>
</a>
</div>
<div class="control">
<a class="button is-primary" href="{% url 'kadenios' %}">
<span>{% trans "Accueil" %}</span>
<span class="icon is-small">
<i class="fas fa-home"></i>
</span>
</a>
</div>
</div>
</form>
</div>
</div>
{% endblock %}