1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2024-12-05 01:26:54 +00:00

Display a warning when the email address is not validated

This commit is contained in:
Yohann D'ANELLO 2020-09-24 18:54:03 +02:00
parent 413525c6d2
commit 471befb1f8
4 changed files with 54 additions and 21 deletions

View File

@ -7,35 +7,36 @@
<div class="card bg-light shadow">
<div class="card-header text-center">
<h4>{{ user.first_name }} {{ user.last_name }}</h4>
<h4>{{ user_object.first_name }} {{ user_object.last_name }}</h4>
</div>
<div class="card-body">
<dl class="row">
<dt class="col-sm-6 text-right">{% trans "Last name:" %}</dt>
<dd class="col-sm-6">{{ user.last_name }}</dd>
<dd class="col-sm-6">{{ user_object.last_name }}</dd>
<dt class="col-sm-6 text-right">{% trans "First name:" %}</dt>
<dd class="col-sm-6">{{ user.first_name }}</dd>
<dd class="col-sm-6">{{ user_object.first_name }}</dd>
<dt class="col-sm-6 text-right">{% trans "Email:" %}</dt>
<dd class="col-sm-6"><a href="mailto:{{ user.email }}">{{ user.email }}</a></dd>
<dd class="col-sm-6"><a href="mailto:{{ user_object.email }}">{{ user_object.email }}</a>
{% if not user_object.registration.email_confirmed %} (<em>{% trans "Not confirmed" %}, <a href="{% url "registration:email_validation_resend" pk=user_object.pk %}">{% trans "resend the validation link" %}</a></em>){% endif %}</dd>
{% if user.registration.studentregistration %}
{% if user_object.registration.studentregistration %}
<dt class="col-sm-6 text-right">{% trans "Student class:" %}</dt>
<dd class="col-sm-6">{{ user.registration.get_student_class_display }}</dd>
<dd class="col-sm-6">{{ user_object.registration.get_student_class_display }}</dd>
<dt class="col-sm-6 text-right">{% trans "School:" %}</dt>
<dd class="col-sm-6">{{ user.registration.school }}</dd>
{% elif user.registration.coachregistration %}
<dd class="col-sm-6">{{ user_object.registration.school }}</dd>
{% elif user_object.registration.coachregistration %}
<dt class="col-sm-6 text-right">{% trans "Profesional activity:" %}</dt>
<dd class="col-sm-6">{{ user.registration.professional_activity }}</dd>
{% elif user.registration.adminregistration %}
<dd class="col-sm-6">{{ user_object.registration.professional_activity }}</dd>
{% elif user_object.registration.adminregistration %}
<dt class="col-sm-6 text-right">{% trans "Role:" %}</dt>
<dd class="col-sm-6">{{ user.registration.role }}</dd>
<dd class="col-sm-6">{{ user_object.registration.role }}</dd>
{% endif %}
<dt class="col-sm-6 text-right">{% trans "Grant Animath to contact me in the future about other actions:" %}</dt>
<dd class="col-sm-6">{{ user.registration.give_contact_to_animath|yesno }}</dd>
<dd class="col-sm-6">{{ user_object.registration.give_contact_to_animath|yesno }}</dd>
</dl>
</div>
<div class="card-footer text-center">
@ -52,7 +53,7 @@
$('button[data-target="#updateUserModal"]').click(function() {
let modalBody = $("#updateUserModal div.modal-body");
if (!modalBody.html().trim())
modalBody.load("{% url "registration:update_user" pk=user.pk %} #form-content");
modalBody.load("{% url "registration:update_user" pk=user_object.pk %} #form-content");
});
});
</script>

View File

@ -127,6 +127,7 @@ class MyAccountDetailView(LoginRequiredMixin, RedirectView):
class UserDetailView(LoginRequiredMixin, DetailView):
model = User
context_object_name = "user_object"
template_name = "registration/user_detail.html"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Corres2math\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-09-24 18:38+0200\n"
"POT-Creation-Date: 2020-09-24 18:52+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Yohann D'ANELLO <yohann.danello@animath.fr>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -274,7 +274,7 @@ msgstr "Autoriser Animath à publier notre vidéo :"
#: apps/participation/templates/participation/update_team_modal.html:15
#: apps/registration/templates/registration/update_user.html:12
#: apps/registration/templates/registration/update_user_modal.html:15
#: apps/registration/templates/registration/user_detail.html:42
#: apps/registration/templates/registration/user_detail.html:43
msgid "Update"
msgstr "Modifier"
@ -559,23 +559,31 @@ msgstr "Prénom :"
msgid "Email:"
msgstr "Adresse e-mail :"
#: apps/registration/templates/registration/user_detail.html:24
#: apps/registration/templates/registration/user_detail.html:22
msgid "Not confirmed"
msgstr "Non confirmée"
#: apps/registration/templates/registration/user_detail.html:22
msgid "resend the validation link"
msgstr "Renvoyer le lien de validation"
#: apps/registration/templates/registration/user_detail.html:25
msgid "Student class:"
msgstr "Classe :"
#: apps/registration/templates/registration/user_detail.html:27
#: apps/registration/templates/registration/user_detail.html:28
msgid "School:"
msgstr "École :"
#: apps/registration/templates/registration/user_detail.html:30
#: apps/registration/templates/registration/user_detail.html:31
msgid "Profesional activity:"
msgstr "Activité professionnelle :"
#: apps/registration/templates/registration/user_detail.html:33
#: apps/registration/templates/registration/user_detail.html:34
msgid "Role:"
msgstr "Rôle :"
#: apps/registration/templates/registration/user_detail.html:37
#: apps/registration/templates/registration/user_detail.html:38
msgid "Grant Animath to contact me in the future about other actions:"
msgstr "Autorise Animath à recontacter à propos d'autres actions :"
@ -692,7 +700,18 @@ msgstr "Mon compte"
msgid "Log out"
msgstr "Déconnexion"
#: templates/base.html:150
#: templates/base.html:139
#, python-format
msgid ""
"Your email address is not validated. Please click on the link you received "
"by email. You can resend a mail by clicking on <a href=\"%(send_email_url)s"
"\">this link</a>."
msgstr ""
"Votre adresse mail n'est pas validée. Merci de cliquer sur le lien que vous "
"avez reçu par mail. Vous pouvez renvoyer un mail en cliquant sur <a href="
"\"%(send_email_url)s\">ce lien</a>."
#: templates/base.html:162
msgid "Contact us"
msgstr "Nous contacter"

View File

@ -130,6 +130,18 @@
</nav>
<div class="{% block containertype %}container{% endblock %} my-3">
{% block contenttitle %}{% endblock %}
{% if user.is_authenticated and not user.registration.email_confirmed %}
<div class="alert alert-warning alert-dismissible">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
{% url "registration:email_validation_resend" pk=user.pk as send_email_url %}
{% blocktrans trimmed %}
Your email address is not validated. Please click on the link you received by email.
You can resend a mail by clicking on <a href="{{ send_email_url }}">this link</a>.
{% endblocktrans %}
</div>
{% endif %}
<div id="messages"></div>
<div id="content">
{% block content %}