mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-02-06 11:33:02 +00:00
Initialize a random password for new organizers
This commit is contained in:
parent
0607398491
commit
47b14c3e47
@ -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>
|
@ -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." %}
|
@ -9,7 +9,7 @@
|
|||||||
<body>
|
<body>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
{% trans "Hi" %} {{ user.username }},
|
{% trans "Hi" %} {{ user.registration }},
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% trans "Hi" %} {{ user.username }},
|
{% trans "Hi" %} {{ user.registration }},
|
||||||
|
|
||||||
{% trans "You recently registered on the TFJM² 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." %}
|
||||||
|
|
||||||
|
@ -6,13 +6,17 @@ import os
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
from django.contrib.sites.models import Site
|
||||||
from django.core.exceptions import PermissionDenied, ValidationError
|
from django.core.exceptions import PermissionDenied, ValidationError
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.http import FileResponse, Http404
|
from django.http import FileResponse, Http404
|
||||||
from django.shortcuts import redirect, resolve_url
|
from django.shortcuts import redirect, resolve_url
|
||||||
|
from django.template.loader import render_to_string
|
||||||
from django.urls import reverse_lazy
|
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.utils.translation import gettext_lazy as _
|
||||||
from django.views.generic import CreateView, DetailView, RedirectView, TemplateView, UpdateView, View
|
from django.views.generic import CreateView, DetailView, RedirectView, TemplateView, UpdateView, View
|
||||||
from django_tables2 import SingleTableView
|
from django_tables2 import SingleTableView
|
||||||
@ -114,6 +118,22 @@ class AddOrganizerView(VolunteerMixin, CreateView):
|
|||||||
registration.save()
|
registration.save()
|
||||||
registration.send_email_validation_link()
|
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
|
return ret
|
||||||
|
|
||||||
def get_success_url(self):
|
def get_success_url(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user