Merge branch 'improvements' into 'master'

Fix signup

See merge request animath/si/plateforme-corres2math!6
This commit is contained in:
Yohann D'ANELLO 2020-12-04 00:49:30 +00:00
commit 91640f8fb1
5 changed files with 103 additions and 14 deletions

View File

@ -1,16 +1,39 @@
{% extends "base.html" %}
{% block extracss %}
<style>
iframe {
width: 100%;
height: 100vh;
margin: 0;
padding: 0;
}
</style>
{% endblock %}
{% load i18n %}
{% block fullcontent %}
<iframe frameborder="0" src="https://element.correspondances-maths.fr/#/room/#faq:correspondances-maths.fr"></iframe>
{% block content %}
<div class="alert alert-warning">
{% blocktrans trimmed %}
The chat is located on the dedicated Matrix server:
{% endblocktrans %}
</div>
<div class="alert text-center">
<a class="btn btn-success" href="https://element.correspondances-maths.fr/#/room/#faq:correspondances-maths.fr" target="_blank">
<i class="fas fa-server"></i> {% trans "Access to the Matrix server" %}
</a>
</div>
<div class="alert alert-info">
<p>
{% blocktrans trimmed %}
To connect to the server, you can select "Log in", then use your credentials of this platform to connect
with the central authentication server, then you must trust the connection between the Matrix account and the
platform. Finally, you will be able to access to the chat platform.
{% endblocktrans %}
</p>
<p>
{% blocktrans trimmed %}
You will be invited in some basic rooms. You must confirm the invitations to join channels.
{% endblocktrans %}
</p>
<p>
{% blocktrans trimmed %}
If you have any trouble, don't hesitate to contact us :)
{% endblocktrans %}
</p>
</div>
{% endblock %}

View File

@ -22,6 +22,15 @@ class SignupForm(UserCreationForm):
],
)
def clean_email(self):
"""
Ensure that the email address is unique.
"""
email = self.data["email"]
if User.objects.filter(email=email).exists():
self.add_error("email", _("This email address is already used."))
return email
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields["first_name"].required = True

View File

@ -119,6 +119,20 @@ class TestRegistration(TestCase):
self.assertRedirects(response, reverse("registration:email_validation_sent"), 302, 200)
self.assertTrue(User.objects.filter(email="toto@example.com").exists())
# Email is already used
response = self.client.post(reverse("registration:signup"), data=dict(
last_name="Toto",
first_name="Toto",
email="toto@example.com",
password1="azertyuiopazertyuiop",
password2="azertyuiopazertyuiop",
role="participant",
student_class=12,
school="God",
give_contact_to_animath=False,
))
self.assertEqual(response.status_code, 200)
response = self.client.get(reverse("registration:email_validation_sent"))
self.assertEqual(response.status_code, 200)

View File

@ -27,6 +27,11 @@
</div>
</div>
<div class="alert alert-danger">
Avertissement : certains rencontrent des difficultés à recevoir les mails automatiques. Merci de vérifier
régulièrement votre boîte spam, et à nous contacter en cas de problème.
</div>
<div class="jumbotron">
<h5 class="display-4">Comment ça marche ?</h5>
<p>

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Corres2math\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-11-16 11:55+0100\n"
"POT-Creation-Date: 2020-12-04 01:42+0100\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"
@ -289,6 +289,40 @@ msgstr "phase"
msgid "phases"
msgstr "phases"
#: apps/participation/templates/participation/chat.html:7
msgid "The chat is located on the dedicated Matrix server:"
msgstr "Le chat est situé sur le serveur Matrix dédié aux Correspondances :"
#: apps/participation/templates/participation/chat.html:14
msgid "Access to the Matrix server"
msgstr "Accéder au serveur Matrix"
#: apps/participation/templates/participation/chat.html:20
msgid ""
"To connect to the server, you can select \"Log in\", then use your "
"credentials of this platform to connect with the central authentication "
"server, then you must trust the connection between the Matrix account and "
"the platform. Finally, you will be able to access to the chat platform."
msgstr ""
"Pour se connecter au serveur, vous pouvez sélectionner \"Se connecter\", "
"puis utiliser vos identifiants de cette plateforme via l'authentication "
"centralisée. Vous devrez ensuite approuver la connexion entre le compte "
"Matrix et la plateforme. Enfin, vous pourrez accéder à la plateforme de chat."
#: apps/participation/templates/participation/chat.html:28
msgid ""
"You will be invited in some basic rooms. You must confirm the invitations to "
"join channels."
msgstr ""
"Vous serez invités dans quelques salons basiques. Vous devez confirmer les "
"invitations pour rejoindre les canaux."
#: apps/participation/templates/participation/chat.html:34
msgid "If you have any trouble, don't hesitate to contact us :)"
msgstr ""
"Si vous rencontrez le moindre problème, n'hésitez surtout pas à nous "
"contacter :)"
#: apps/participation/templates/participation/create_team.html:11
#: corres2math/templates/base.html:237
msgid "Create"
@ -751,7 +785,11 @@ msgstr "participant"
msgid "coach"
msgstr "encadrant"
#: apps/registration/forms.py:68
#: apps/registration/forms.py:31
msgid "This email address is already used."
msgstr "Cette adresse e-mail est déjà utilisée."
#: apps/registration/forms.py:77
msgid "The uploaded file must be a PDF, PNG of JPEG file."
msgstr "Le fichier envoyé doit être au format PDF, PNG ou JPEG."