Use cards for registration templates

This commit is contained in:
Alexandre Iooss 2020-08-21 17:52:48 +02:00
parent 8c46321c95
commit 5c3451bda7
3 changed files with 74 additions and 55 deletions

View File

@ -3,8 +3,6 @@
SPDX-License-Identifier: GPL-2.0-or-later SPDX-License-Identifier: GPL-2.0-or-later
{% endcomment %} {% endcomment %}
{% load i18n crispy_forms_tags static %} {% load i18n crispy_forms_tags static %}
{# Change page title without displaying it in header #}
{% block title %}{% trans "Log in" %}{% endblock %} {% block title %}{% trans "Log in" %}{% endblock %}
{% block contenttitle %}{% endblock %} {% block contenttitle %}{% endblock %}
@ -13,34 +11,35 @@ SPDX-License-Identifier: GPL-2.0-or-later
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<main class="card bg-light border-dark mx-auto" style="max-width: 30rem;"> <div class="card bg-light mx-auto" style="max-width: 30rem;">
<h3 class="card-header text-center"> <h3 class="card-header text-center">
{% trans "Log in" %} {% trans "Log in" %}
</h3> </h3>
<div class="card-body"> <div class="card-body">
{% if user.is_authenticated %} {% if user.is_authenticated %}
<div class="alert alert-warning"> <div class="alert alert-warning">
{% blocktrans trimmed with username=request.user.username %} {% blocktrans trimmed with username=request.user.username %}
You are authenticated as {{ username }}, but are not authorized to You are authenticated as {{ username }}, but are not authorized to
access this page. Would you like to login to a different account, access this page. Would you like to login to a different account,
or with a higher permission mask? or with a higher permission mask?
{% endblocktrans %} {% endblocktrans %}
</div>
{% endif %}
{% if request.resolver_match.view_name == 'admin:login' %}
<div class="alert alert-info">
{% blocktrans trimmed %}
You must be logged with a staff account with the higher mask to access Django Admin.
{% endblocktrans %}
</div>
{% endif %}
<form action="{{ app_path }}" method="post" id="login-form">{% csrf_token %}
{{ form | crispy }}
<input type="submit" value="{% trans 'Log in' %}" class="btn btn-primary btn-block btn-lg">
<a href="{% url 'password_reset' %}" class="badge badge-light">{% trans 'Forgotten your password or username?' %}</a>
</form>
</div> </div>
</main> {% endif %}
{% if request.resolver_match.view_name == 'admin:login' %}
<div class="alert alert-info">
{% blocktrans trimmed %}
You must be logged with a staff account with the higher mask to access Django Admin.
{% endblocktrans %}
</div>
{% endif %}
<form action="{{ app_path }}" method="post" id="login-form">{% csrf_token %}
{{ form | crispy }}
<input type="submit" value="{% trans 'Log in' %}" class="btn btn-primary btn-block btn-lg">
<a href="{% url 'password_reset' %}"
class="badge badge-light">{% trans 'Forgotten your password or username?' %}</a>
</form>
</div>
</div>
{% endblock %} {% endblock %}

View File

@ -3,11 +3,21 @@
SPDX-License-Identifier: GPL-3.0-or-later SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %} {% endcomment %}
{% load i18n crispy_forms_tags %} {% load i18n crispy_forms_tags %}
{% block contenttitle %}{% endblock %}
{% block content %} {% block content %}
<p>{% trans "Forgotten your password? Enter your email address below, and we'll email instructions for setting a new one." %}</p> <div class="card bg-light">
<form method="post">{% csrf_token %} <h3 class="card-header text-center">
{{ form | crispy }} {% trans "Password reset" %}
<input class="btn btn-primary" type="submit" value="{% trans 'Reset my password' %}"> </h3>
</form> <div class="card-body">
<p>{% trans "Forgotten your password? Enter your email address below, and we'll email instructions for setting a new one." %}</p>
<form method="post">
{% csrf_token %}
{{ form | crispy }}
<input class="btn btn-primary" type="submit" value="{% trans 'Reset my password' %}">
</form>
</div>
</div>
{% endblock %} {% endblock %}

View File

@ -1,23 +1,33 @@
<!-- templates/signup.html -->
{% extends 'base.html' %} {% extends 'base.html' %}
{% load crispy_forms_tags %} {% comment %}
{% load i18n %} SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load i18n crispy_forms_tags %}
{% block title %}{% trans "Sign up" %}{% endblock %} {% block title %}{% trans "Sign up" %}{% endblock %}
{% block contenttitle %}{% endblock %}
{# Use a fixed-width container #}
{% block containertype %}container{% endblock %}
{% block content %} {% block content %}
<div class="alert alert-warning"> <div class="card bg-light">
{% blocktrans %}If you already signed up, your registration is taken into account. The BDE must validate your account before your can log in. You have to go to the Kfet and pay the registration fee. You must also validate your email address by following the link you received.{% endblocktrans %} <h3 class="card-header text-center">
</div> {% trans "Sign up" %}
</h3>
<div class="card-body">
<div class="alert alert-warning">
{% blocktrans trimmed %}
If you already signed up, your registration is taken into account. The BDE must validate
your account before your can log in. You have to go to the Kfet and pay the registration fee. You must also
validate your email address by following the link you received.
{% endblocktrans %}
</div>
<form method="post"> <form method="post">
{% csrf_token %} {% csrf_token %}
{{ form|crispy }} {{ form|crispy }}
{{ profile_form|crispy }} {{ profile_form|crispy }}
<button class="btn btn-success" type="submit"> <button class="btn btn-success" type="submit">
{% trans "Sign up" %} {% trans "Sign up" %}
</button> </button>
</form> </form>
</div>
</div>
{% endblock %} {% endblock %}