From 289f6caa88712a9ccf411db2e058ad18b2cf6b6f Mon Sep 17 00:00:00 2001 From: Jean-Romain Garnier Date: Fri, 17 Apr 2020 12:54:28 +0000 Subject: [PATCH] Improve various templates related to email confirmation --- users/models.py | 5 +++-- users/templates/users/confirm_email.html | 2 +- users/templates/users/email_confirmation_request | 4 ++-- users/templates/users/profil.html | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/users/models.py b/users/models.py index 1e0db421..6b570337 100755 --- a/users/models.py +++ b/users/models.py @@ -809,7 +809,7 @@ class User( return None days = OptionalUser.get_cached_value("disable_emailnotyetconfirmed") - return str(self.email_change_date + timedelta(days=days)) + return self.email_change_date + timedelta(days=days) def confirm_email_address_mail(self, request): """Prend en argument un request, envoie un mail pour @@ -829,7 +829,8 @@ class User( reverse("users:process", kwargs={"token": req.token}) ), "expire_in": str(GeneralOption.get_cached_value("req_expire_hrs")), - "confirm_before": self.confirm_email_before_date(), + "confirm_before_fr": self.confirm_email_before_date().strftime("%d/%m/%Y"), + "confirm_before_en": self.confirm_email_before_date().strftime("%Y-%m-%d"), } send_mail( "Confirmation de l'email de %(name)s / Email confirmation for " diff --git a/users/templates/users/confirm_email.html b/users/templates/users/confirm_email.html index c90af524..6d562377 100644 --- a/users/templates/users/confirm_email.html +++ b/users/templates/users/confirm_email.html @@ -33,7 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
{% csrf_token %}

{% blocktrans %}Confirmation email{% endblocktrans %}

-

{% blocktrans %}Confirm the email{% endblocktrans %} {{ email }} {% blocktrans %}for user {{ firstname }} {{ lastname }}.{% endblocktrans %}

+

{% blocktrans %}Confirm the email{% endblocktrans %} {{ email }} {% blocktrans %}for {{ firstname }} {{ lastname }}.{% endblocktrans %}

{% trans "Confirm" as tr_confirm %} {% bootstrap_button tr_confirm button_type="submit" icon="ok" button_class="btn-success" %}
diff --git a/users/templates/users/email_confirmation_request b/users/templates/users/email_confirmation_request index 65e20c13..8c5fe03d 100644 --- a/users/templates/users/email_confirmation_request +++ b/users/templates/users/email_confirmation_request @@ -11,7 +11,7 @@ Contactez les administrateurs si vous n'êtes pas à l'origine de cette requête Ce lien expirera dans {{ expire_in }} heures. S'il a expiré, vous pouvez renvoyer un mail de confirmation depuis votre compte {{ site_name }}. -Attention : Si vous ne confirmez pas votre email avant le {{ confirm_before }}, votre compte sera suspendu. +/!\ Attention : Si vous ne confirmez pas votre email avant le {{ confirm_before_fr }}, votre compte sera suspendu. Respectueusement, @@ -32,7 +32,7 @@ Contact the administrators if you didn't request this. This link will expire in {{ expire_in }} hours. If it has expired, you can send a new confirmation email from your account on {{ site_name }}. -Warning: If you do not confirm your email before {{ confirm_before }}, your account will be suspended. +/!\ Warning: If you do not confirm your email before {{ confirm_before_en }}, your account will be suspended. Regards, diff --git a/users/templates/users/profil.html b/users/templates/users/profil.html index 84871045..1e52d61a 100644 --- a/users/templates/users/profil.html +++ b/users/templates/users/profil.html @@ -42,7 +42,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {% if users.state == users.STATE_EMAIL_NOT_YET_CONFIRMED %}
- {% blocktrans %}Please confirm your email address before {{ users.confirm_email_before_date }}, or your account will be suspended.{% endblocktrans %} + {% blocktrans with confirm_before_date=users.confirm_email_before_date|date:"DATE_FORMAT" %}Please confirm your email address before {{ confirm_before_date }}, or your account will be suspended.{% endblocktrans %}
{% blocktrans %}Didn't receive the email?{% endblocktrans %}