8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-27 07:02:26 +00:00

Notify users of suspension when they failed to confirm their email

This commit is contained in:
Jean-Romain Garnier 2020-04-17 15:16:26 +02:00 committed by Gabriel Detraz
parent 0a8ed0bb40
commit c71c41fea8
3 changed files with 39 additions and 0 deletions

View file

@ -41,4 +41,5 @@ class Command(BaseCommand):
for user in users_to_disable:
user.state = User.STATE_DISABLED
user.notif_disable()
user.save()

View file

@ -895,6 +895,24 @@ class User(
)
return
def notif_disable(self):
"""Envoi un mail de notification informant que l'adresse mail n'a pas été confirmée"""
template = loader.get_template("users/email_disable_notif")
context = {
"name": self.get_full_name(),
"asso_name": AssoOption.get_cached_value("name"),
"asso_email": AssoOption.get_cached_value("contact"),
"site_name": GeneralOption.get_cached_value("site_name"),
}
send_mail(
"Suspension automatique / Automatic suspension",
template.render(context),
GeneralOption.get_cached_value("email_from"),
[self.email],
fail_silently=False,
)
return
def set_password(self, password):
""" A utiliser de préférence, set le password en hash courrant et
dans la version ntlm"""

View file

@ -0,0 +1,20 @@
Bonjour {{ name }},
Votre connexion a été automatiquement suspendue car votre adresse mail n'a pas été confirmée. Vous pouvez renvoyer un mail de confirmation sur votre compte {{ site_name }} pour réactiver votre connexion.
Pour de plus amples renseignements, contactez {{ asso_name }} à l'adresse {{ asso_mail }}.
Respectueusement,
L'équipe de {{ asso_name }}.
---
Hello {{ name }},
Your connection has automatically been suspended because you have not confirmed your email address. You can ask for a new confirmation email to be sent on your profil at {{ site_name }} to enable your connection.
For more information, contactez {{ asso_name }} at {{ asso_mail }}.
Regards,
The {{ asso_name }} team.