1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-02-13 23:41:19 +00:00

Compare commits

...

4 Commits

Author SHA1 Message Date
Yohann D'ANELLO
e0f230b8c7
Update translations 2021-01-18 16:15:16 +01:00
Yohann D'ANELLO
47b14c3e47
Initialize a random password for new organizers 2021-01-18 16:12:00 +01:00
Yohann D'ANELLO
0607398491
This is TFJM², not Corres2math 2021-01-18 15:52:09 +01:00
Yohann D'ANELLO
a454441097
Display edit password button 2021-01-18 15:43:17 +01:00
19 changed files with 342 additions and 228 deletions

View File

@ -68,7 +68,7 @@ class RequestValidationForm(forms.Form):
)
engagement = forms.BooleanField(
label=_("I engage myself to participate to the whole \"Correspondances\"."),
label=_("I engage myself to participate to the whole TFJM²."),
required=True,
)

View File

@ -21,7 +21,7 @@ from tfjm.matrix import Matrix, RoomPreset, RoomVisibility
class Team(models.Model):
"""
The Team model represents a real team that participates to the Correspondances.
The Team model represents a real team that participates to the TFJM².
This only includes the registration detail.
"""
name = models.CharField(

View File

@ -11,7 +11,7 @@ Bonjour {{ user.registration }},
<p>
L'équipe « {{ team.name }} » ({{ team.trigram }}) vient de demander à valider son équipe pour participer
au {{ team.participation.get_problem_display }} du TFJM² des Jeunes Mathématicien·ne·s.
au {{ team.participation.get_problem_display }} du TFJM².
Vous pouvez décider d'accepter ou de refuser l'équipe en vous rendant sur la page de l'équipe :
<a href="https://{{ domain }}{% url "participation:team_detail" pk=team.pk %}">
https://{{ domain }}{% url "participation:team_detail" pk=team.pk %}
@ -23,7 +23,7 @@ Cordialement,
</p>
<p>
L'organisation du TFJM² des Jeunes Mathématicien·ne·s
L'organisation du TFJM²
</p>
</body>
</html>

View File

@ -1,10 +1,10 @@
Bonjour {{ user.registration }},
L'équipe « {{ team.name }} » ({{ team.trigram }}) vient de demander à valider son équipe pour participer
au {{ team.participation.get_problem_display }} du TFJM² des Jeunes Mathématicien·ne·s.
au {{ team.participation.get_problem_display }} du TFJM².
Vous pouvez décider d'accepter ou de refuser l'équipe en vous rendant sur la page de l'équipe :
https://{{ domain }}{% url "participation:team_detail" pk=team.pk %}
Cordialement,
L'organisation du TFJM² des Jeunes Mathématicien·ne·s
L'organisation du TFJM²

View File

@ -17,6 +17,6 @@ pour plus d'informations.
<br/>
Cordialement,<br/>
<br/>
Le comité d'organisation du TFJM² des Jeunes Mathématicien·ne·s
Le comité d'organisation du TFJM²
</body>
</html>

View File

@ -9,4 +9,4 @@ N'hésitez pas à nous contacter à l'adresse contact@tfjm.org pour plus d'infor
Cordialement,
Le comité d'organisation du TFJM² des Jeunes Mathématicien·ne·s
Le comité d'organisation du TFJM²

View File

@ -7,14 +7,14 @@
<body>
Bonjour,<br/>
<br/>
Félicitations ! Votre équipe « {{ team.name }} » ({{ team.trigram }}) est désormais validée ! Vous êtes désormais apte à travailler sur
votre problème. Lorsque les Correspondances auront débutées, vous pourrez soumettre votre vidéo sur la plateforme d'inscription.<br>
Félicitations ! Votre équipe « {{ team.name }} » ({{ team.trigram }}) est désormais validée ! Vous êtes désormais apte
à travailler sur vos problèmes. Vous pourrez ensuite envoyer vos solutions sur la plateforme.<br>
Les organisateurs vous adressent ce message :<br/>
<br/>
{{ message }}<br />
<br/>
Cordialement,<br/>
<br/>
Le comité d'organisation du TFJM² des Jeunes Mathématicien·ne·s
Le comité d'organisation du TFJM²
</body>
</html>

View File

@ -1,7 +1,7 @@
Bonjour,
Félicitations ! Votre équipe « {{ team.name }} » ({{ team.trigram }}) est désormais validée ! Vous êtes désormais apte à travailler sur
votre problème. Lorsque les Correspondances auront débutées, vous pourrez soumettre votre vidéo sur la plateforme d'inscription.
Félicitations ! Votre équipe « {{ team.name }} » ({{ team.trigram }}) est désormais validée ! Vous êtes désormais apte
à travailler sur vos problèmes. Vous pourrez ensuite envoyer vos solutions sur la plateforme.
Les organisateurs vous adressent ce message :
@ -9,4 +9,4 @@ Les organisateurs vous adressent ce message :
Cordialement,
Le comité d'organisation du TFJM² des Jeunes Mathématicien·ne·s
Le comité d'organisation du TFJM²

View File

@ -218,7 +218,7 @@ class TeamDetailView(LoginRequiredMixin, FormMixin, ProcessFormView, DetailView)
mail_context = dict(user=admin.user, team=self.object, domain=Site.objects.first().domain)
mail_plain = render_to_string("participation/mails/request_validation.txt", mail_context)
mail_html = render_to_string("participation/mails/request_validation.html", mail_context)
admin.user.email_user("[Corres2math] Validation d'équipe", mail_plain, html_message=mail_html)
admin.user.email_user("[TFJM²] Validation d'équipe", mail_plain, html_message=mail_html)
return super().form_valid(form)
def handle_validate_participation(self, form):
@ -238,7 +238,7 @@ class TeamDetailView(LoginRequiredMixin, FormMixin, ProcessFormView, DetailView)
mail_context = dict(team=self.object, message=form.cleaned_data["message"])
mail_plain = render_to_string("participation/mails/team_validated.txt", mail_context)
mail_html = render_to_string("participation/mails/team_validated.html", mail_context)
send_mail("[Corres2math] Équipe validée", mail_plain, None, [self.object.email], html_message=mail_html)
send_mail("[TFJM²] Équipe validée", mail_plain, None, [self.object.email], html_message=mail_html)
get_sympa_client().subscribe(self.object.email, "equipes", False, f"Equipe {self.object.name}")
get_sympa_client().unsubscribe(self.object.email, "equipes-non-valides", False)
@ -248,7 +248,7 @@ class TeamDetailView(LoginRequiredMixin, FormMixin, ProcessFormView, DetailView)
mail_context = dict(team=self.object, message=form.cleaned_data["message"])
mail_plain = render_to_string("participation/mails/team_not_validated.txt", mail_context)
mail_html = render_to_string("participation/mails/team_not_validated.html", mail_context)
send_mail("[Corres2math] Équipe non validée", mail_plain, None, [self.object.email],
send_mail("[TFJM²] Équipe non validée", mail_plain, None, [self.object.email],
html_message=mail_html)
else:
form.add_error(None, _("You must specify if you validate the registration or not."))

View File

@ -45,7 +45,7 @@ class Registration(PolymorphicModel):
The account got created or the email got changed.
Send an email that contains a link to validate the address.
"""
subject = "[Corres2math] " + str(_("Activate your Correspondances account"))
subject = "[TFJM²] " + str(_("Activate your TFJM² account"))
token = email_validation_token.make_token(self.user)
uid = urlsafe_base64_encode(force_bytes(self.user.pk))
site = Site.objects.first()

View File

@ -20,7 +20,7 @@ class RegistrationTable(tables.Table):
def order_type(self, queryset, desc):
types = ["volunteerregistration__adminregistration", "volunteerregistration", "participantregistration"]
return queryset.order_by(*(("" if desc else "-") + t for t in types)), True
return queryset.order_by(*(("-" if desc else "") + t for t in types)), True
class Meta:
attrs = {
@ -28,5 +28,5 @@ class RegistrationTable(tables.Table):
}
model = Registration
fields = ('last_name', 'user__first_name', 'user__email', 'type',)
order_by = ('volunteerregistration__adminregistration', 'volunteerregistration', 'last_name', 'first_name',)
order_by = ('type', 'last_name', 'first_name',)
template_name = 'django_tables2/bootstrap4.html'

View File

@ -0,0 +1,38 @@
{% load i18n %}
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<p>
Bonjour {{ user.registration }},
</p>
<p>
Vous avez été invités par {{ inviter }} à rejoindre la plateforme du TFJM², accessible à l'adresse
<a href="https://{{ domain }}/">https://{{ domain }}/</a>. Vous disposez d'un compte d'organisateur.
</p>
<p>
Un mot de passe aléatoire a été défini : <strong>{{ password }}</strong>.
Par sécurité, merci de le changer dès votre connexion.
</p>
<p>
En cas de problème, merci de nous contacter soit par mail à l'adresse
<a href="mailto:contact@tfjm.org">contact@tfjm.org</a>, soit sur la plateforme de chat accessible sur
<a href="https://element.tfjm.org/">https://element.tfjm.org/</a> en vous connectant avec les mêmes identifiants.
</p>
<p>
Bien cordialement,
</p>
--
<p>
{% trans "The TFJM² team." %}<br>
</p>

View File

@ -0,0 +1,17 @@
{% load i18n %}
Bonjour {{ user.registration }},
Vous avez été invités par {{ inviter }} à rejoindre la plateforme du TFJM², accessible à l'adresse
https://{{ domain }}/. Vous disposez d'un compte d'organisateur.
Un mot de passe aléatoire a été défini : {{ password }}.
Par sécurité, merci de le changer dès votre connexion.
En cas de problème, merci de nous contacter soit par mail à l'adresse contact@tfjm.org, soit sur la plateforme
de chat accessible sur https://element.tfjm.org/ en vous connectant avec les mêmes identifiants.
Bien cordialement,
--
{% trans "The TFJM² team." %}

View File

@ -9,11 +9,11 @@
<body>
<p>
{% trans "Hi" %} {{ user.username }},
{% trans "Hi" %} {{ user.registration }},
</p>
<p>
{% trans "You recently registered on the Correspondances platform. Please click on the link below to confirm your registration." %}
{% trans "You recently registered on the TFJM² platform. Please click on the link below to confirm your registration." %}
</p>
<p>

View File

@ -1,8 +1,8 @@
{% load i18n %}
{% trans "Hi" %} {{ user.username }},
{% trans "Hi" %} {{ user.registration }},
{% trans "You recently registered on the Correspondances platform. Please click on the link below to confirm your registration." %}
{% trans "You recently registered on the TFJM² platform. Please click on the link below to confirm your registration." %}
https://{{ domain }}{% url 'registration:email_validation' uidb64=uid token=token %}

View File

@ -21,6 +21,15 @@
<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_object == user %}
<dt class="col-sm-6 text-right">{% trans "Password:" %}</dt>
<dd class="col-sm-6">
<a href="{% url 'password_change' %}" class="btn-sm btn-secondary" data-turbolinks="false">
<i class="fas fa-edit"></i> {% trans "Change password" %}
</a>
</dd>
{% endif %}
{% if user_object.registration.participates %}
<dt class="col-sm-6 text-right">{% trans "Team:" %}</dt>
{% trans "any" as any %}

View File

@ -6,13 +6,17 @@ import os
from django.conf import settings
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.core.exceptions import PermissionDenied, ValidationError
from django.db import transaction
from django.db.models import Q
from django.http import FileResponse, Http404
from django.shortcuts import redirect, resolve_url
from django.template.loader import render_to_string
from django.urls import reverse_lazy
from django.utils.http import urlsafe_base64_decode
from django.utils.crypto import get_random_string
from django.utils.encoding import force_bytes
from django.utils.http import urlsafe_base64_decode, urlsafe_base64_encode
from django.utils.translation import gettext_lazy as _
from django.views.generic import CreateView, DetailView, RedirectView, TemplateView, UpdateView, View
from django_tables2 import SingleTableView
@ -114,6 +118,22 @@ class AddOrganizerView(VolunteerMixin, CreateView):
registration.save()
registration.send_email_validation_link()
password = get_random_string(16)
form.instance.set_password(password)
form.instance.save()
subject = "[TFJM²] " + str(_("New TFJM² organizer account"))
site = Site.objects.first()
message = render_to_string('registration/mails/add_organizer.txt', dict(user=registration.user,
inviter=self.request.user,
password=password,
domain=site.domain))
html = render_to_string('registration/mails/add_organizer.html', dict(user=registration.user,
inviter=self.request.user,
password=password,
domain=site.domain))
registration.user.email_user(subject, message, html_message=html)
return ret
def get_success_url(self):

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@
{% block content %}
<p>
La plateforme d'inscription du TFJM² des Jeunes Mathématiciennes a été développée entre 2019 et 2021
La plateforme d'inscription du TFJM² a été développée entre 2019 et 2021
par Yohann D'ANELLO, bénévole pour l'association Animath. Elle est vouée à être utilisée par les participants
pour intéragir avec les organisateurs et les autres participants.
</p>