1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-11-26 18:37:12 +00:00

Password reset use cards

This commit is contained in:
Alexandre Iooss 2020-08-21 18:34:20 +02:00
parent b7d4a17ffd
commit 5ea1eed76d
8 changed files with 102 additions and 45 deletions

View File

@ -1,36 +1,42 @@
{% extends "base.html" %} {% extends "base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load render_table from django_tables2 %} {% load render_table from django_tables2 %}
{% load crispy_forms_tags %} {% load i18n crispy_forms_tags perms %}
{% load i18n %} {% block contenttitle %}{% endblock %}
{% load perms %}
{% block content %} {% block content %}
<input id="searchbar" type="text" class="form-control" placeholder="Nom/prénom/note/section ..."> {% if "member.change_profile_registration_valid"|has_perm:user %}
<a class="btn btn-block btn-secondary mb-3" href="{% url 'registration:future_user_list' %}">
<i class="fas fa-user-plus"></i> {% trans "Registrations" %}
</a>
{% endif %}
<hr> <div class="card bg-light">
<h3 class="card-header text-center">
<div id="user_table"> {{ title }}
{% if table.data %} </h3>
<div class="card-body">
<input id="searchbar" type="text" class="form-control" placeholder="Nom/prénom/note/section...">
</div>
<div class="card-body">
<div id="user_table">
{% if table.data %}
{% render_table table %} {% render_table table %}
{% else %} {% else %}
<div class="alert alert-warning"> <div class="alert alert-warning">
{% trans "There is no user with this pattern." %} {% trans "There is no user with this pattern." %}
</div> </div>
{% endif %} {% endif %}
</div>
</div> </div>
</div>
<hr>
{% if "member.change_profile_registration_valid"|has_perm:user %}
<a class="btn btn-block btn-secondary" href="{% url 'registration:future_user_list' %}">
<i class="fas fa-user-plus"></i> {% trans "Registrations" %}
</a>
{% endif %}
{% endblock %} {% endblock %}
{% block extrajavascript %} {% block extrajavascript %}
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function () {
let old_pattern = null; let old_pattern = null;
let searchbar_obj = $("#searchbar"); let searchbar_obj = $("#searchbar");
var timer_on = false; var timer_on = false;
@ -45,7 +51,7 @@
$("#user_table").load(location.pathname + "?search=" + pattern.replace(" ", "%20") + " #user_table", init); $("#user_table").load(location.pathname + "?search=" + pattern.replace(" ", "%20") + " #user_table", init);
} }
searchbar_obj.keyup(function() { searchbar_obj.keyup(function () {
if (timer_on) if (timer_on)
clearTimeout(timer); clearTimeout(timer);
timer_on = true; timer_on = true;
@ -53,13 +59,14 @@
}); });
function init() { function init() {
$(".table-row").click(function() { $(".table-row").click(function () {
window.document.location = $(this).data("href"); window.document.location = $(this).data("href");
timer_on = false; timer_on = false;
}); });
$("tr").each(function() { // Highlight searched terms
$(this).find("td:eq(0), td:eq(1), td:eq(2), td:eq(3), td:eq(5)").each(function() { $("tr").each(function () {
$(this).find("td:eq(0), td:eq(1), td:eq(2), td:eq(3), td:eq(5)").each(function () {
$(this).html($(this).text().replace(new RegExp(searchbar_obj.val(), 'i'), "<mark>$&</mark>")); $(this).html($(this).text().replace(new RegExp(searchbar_obj.val(), 'i'), "<mark>$&</mark>"));
}); });
}); });
@ -68,4 +75,4 @@
init(); init();
}); });
</script> </script>
{% endblock %} {% endblock %}

View File

@ -3,8 +3,16 @@
SPDX-License-Identifier: GPL-3.0-or-later SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %} {% endcomment %}
{% load i18n %} {% load i18n %}
{% block contenttitle %}{% endblock %}
{% block content %} {% block content %}
<p>{% trans "Thanks for spending some quality time with the Web site today." %}</p> <div class="card bg-light">
<p><a href="{% url 'index' %}">{% trans 'Log in again' %}</a></p> <h3 class="card-header text-center">
{{ title }}
</h3>
<div class="card-body">
<p>{% trans "Thanks for spending some quality time with the Web site today." %}</p>
<p><a href="{% url 'index' %}">{% trans 'Log in again' %}</a></p>
</div>
</div>
{% endblock %} {% endblock %}

View File

@ -3,7 +3,15 @@
SPDX-License-Identifier: GPL-3.0-or-later SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %} {% endcomment %}
{% load i18n %} {% load i18n %}
{% block contenttitle %}{% endblock %}
{% block content %} {% block content %}
<p>{% trans 'Your password was changed.' %}</p> <div class="card bg-light">
<h3 class="card-header text-center">
{{ title }}
</h3>
<div class="card-body">
<p>{% trans 'Your password was changed.' %}</p>
</div>
</div>
{% endblock %} {% endblock %}

View File

@ -3,11 +3,19 @@
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 %}
<form method="post">{% csrf_token %} <div class="card bg-light">
<p>{% trans "Please enter your old password, for security's sake, and then enter your new password twice so we can verify you typed it in correctly." %}</p> <h3 class="card-header text-center">
{{ form | crispy }} {{ title }}
<input class="btn btn-primary" type="submit" value="{% trans 'Change my password' %}"> </h3>
</form> <div class="card-body">
{% endblock %} <form method="post">{% csrf_token %}
<p>{% trans "Please enter your old password, for security's sake, and then enter your new password twice so we can verify you typed it in correctly." %}</p>
{{ form | crispy }}
<input class="btn btn-primary" type="submit" value="{% trans 'Change my password' %}">
</form>
</div>
</div>
{% endblock %}

View File

@ -3,10 +3,18 @@
SPDX-License-Identifier: GPL-3.0-or-later SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %} {% endcomment %}
{% load i18n %} {% load i18n %}
{% block contenttitle %}{% endblock %}
{% block content %} {% block content %}
<p>{% trans "Your password has been set. You may go ahead and log in now." %}</p> <div class="card bg-light">
<p> <h3 class="card-header text-center">
<a href="{{ login_url }}" class="btn btn-success">{% trans 'Log in' %}</a> {{ title }}
</p> </h3>
<div class="card-body">
<p>{% trans "Your password has been set. You may go ahead and log in now." %}</p>
<p>
<a href="{{ login_url }}" class="btn btn-success">{% trans 'Log in' %}</a>
</p>
</div>
</div>
{% endblock %} {% endblock %}

View File

@ -3,15 +3,25 @@
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 %}
{% if validlink %} <div class="card bg-light">
<h3 class="card-header text-center">
{{ title }}
</h3>
<div class="card-body">
{% if validlink %}
<p>{% trans "Please enter your new password twice so we can verify you typed it in correctly." %}</p> <p>{% trans "Please enter your new password twice so we can verify you typed it in correctly." %}</p>
<form method="post">{% csrf_token %} <form method="post">{% csrf_token %}
{{ form | crispy }} {{ form | crispy }}
<input class="btn btn-primary" type="submit" value="{% trans 'Change my password' %}"> <input class="btn btn-primary" type="submit" value="{% trans 'Change my password' %}">
</form> </form>
{% else %} {% else %}
<p>{% trans "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}</p> <p>
{% endif %} {% trans "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}
{% endblock %} </p>
{% endif %}
</div>
</div>
{% endblock %}

View File

@ -3,8 +3,16 @@
SPDX-License-Identifier: GPL-3.0-or-later SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %} {% endcomment %}
{% load i18n %} {% load i18n %}
{% block contenttitle %}{% endblock %}
{% block content %} {% block content %}
<p>{% trans "We've emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly." %}</p> <div class="card bg-light">
<p>{% trans "If you don't receive an email, please make sure you've entered the address you registered with, and check your spam folder." %}</p> <h3 class="card-header text-center">
{{ title }}
</h3>
<div class="card-body">
<p>{% trans "We've emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly." %}</p>
<p>{% trans "If you don't receive an email, please make sure you've entered the address you registered with, and check your spam folder." %}</p>
</div>
</div>
{% endblock %} {% endblock %}

View File

@ -8,7 +8,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
{% block content %} {% block content %}
<div class="card bg-light"> <div class="card bg-light">
<h3 class="card-header text-center"> <h3 class="card-header text-center">
{% trans "Password reset" %} {{ title }}
</h3> </h3>
<div class="card-body"> <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> <p>{% trans "Forgotten your password? Enter your email address below, and we'll email instructions for setting a new one." %}</p>