1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-21 23:58:24 +02:00

Add specific login and logout pages for chat

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello
2024-04-28 11:57:25 +02:00
parent 7bb0f78f34
commit e77cc558de
8 changed files with 116 additions and 58 deletions

View File

@ -102,6 +102,7 @@ MIDDLEWARE = [
ROOT_URLCONF = 'tfjm.urls'
LOGIN_REDIRECT_URL = "index"
LOGOUT_REDIRECT_URL = "login"
TEMPLATES = [
{

View File

@ -0,0 +1,23 @@
{% load i18n crispy_forms_filters %}
{% if user.is_authenticated %}
<p class="errornote">
{% blocktrans trimmed %}
You are authenticated as {{ user }}, but are not authorized to
access this page. Would you like to login to a different account?
{% endblocktrans %}
</p>
{% endif %}
<form method="post" id="login-form">
<div id="form-content">
{{ form|as_crispy_errors }}
{% csrf_token %}
{{ form.username|as_crispy_field }}
<div class="form-text mb-3">
<i class="fas fa-info-circle"></i> {% trans "Your username is your e-mail address." %}
</div>
{{ form.password|as_crispy_field }}
<a href="{% url 'password_reset' %}" class="badge text-bg-warning">{% trans 'Forgotten your password?' %}</a>
</div>
<input type="submit" value="{% trans 'Log in' %}" class="btn btn-primary">
</form>

View File

@ -2,31 +2,11 @@
{% comment %}
SPDX-License-Identifier: GPL-2.0-or-later
{% endcomment %}
{% load i18n crispy_forms_filters %}
{% load i18n %}
{% block title %}{% trans "Log in" %}{% endblock %}
{% block content-title %}<h1>{% trans "Log in" %}</h1>{% endblock %}
{% block content %}
{% if user.is_authenticated %}
<p class="errornote">
{% blocktrans trimmed %}
You are authenticated as {{ user }}, but are not authorized to
access this page. Would you like to login to a different account?
{% endblocktrans %}
</p>
{% endif %}
<form method="post" id="login-form">
<div id="form-content">
{{ form|as_crispy_errors }}
{% csrf_token %}
{{ form.username|as_crispy_field }}
<div class="form-text mb-3">
<i class="fas fa-info-circle"></i> {% trans "Your username is your e-mail address." %}
</div>
{{ form.password|as_crispy_field }}
<a href="{% url 'password_reset' %}" class="badge text-bg-warning">{% trans 'Forgotten your password?' %}</a>
</div>
<input type="submit" value="{% trans 'Log in' %}" class="btn btn-primary">
</form>
{% include "registration/includes/login.html" %}
{% endblock %}