Browse Source

refactor(api): merge account activation email templates

Peter Thomassen 3 years ago
parent
commit
a76ab2435b

+ 0 - 1
api/desecapi/models.py

@@ -165,7 +165,6 @@ class User(ExportModelOperationsMixin('User'), AbstractBaseUser):
         immediate_lane = 'email_immediate_lane'
         lanes = {
             'activate': slow_lane,
-            'activate-with-domain': slow_lane,
             'change-email': slow_lane,
             'change-email-confirmation-old-email': fast_lane,
             'password-change-confirmation': fast_lane,

+ 0 - 23
api/desecapi/templates/emails/activate-with-domain/content.txt

@@ -1,23 +0,0 @@
-Hi there,
-
-Thank you for registering with deSEC! You are about to set up the
-following domain: {{ domain }}
-
-To create your account and finish the registration, please confirm you
-received this email by clicking on the following link (valid for {{ link_expiration_hours }}
-hours):
-
-{{ confirmation_link }}
-
-After that, please follow the instructions on the confirmation page.
-If link has already expired, please register again.
-
-Please also take a look at the following resources:
-
-  - Discussion forum: https://talk.desec.io/
-  - Documentation: https://desec.readthedocs.io/
-
-We hope you enjoy deSEC!
-
-Stay secure,
-Nils

+ 0 - 1
api/desecapi/templates/emails/activate-with-domain/subject.txt

@@ -1 +0,0 @@
-Welcome to deSEC!

+ 8 - 3
api/desecapi/templates/emails/activate/content.txt

@@ -1,11 +1,16 @@
 Hi there,
 
-Thank you for registering with deSEC!
-
+Thank you for registering with deSEC!{% if domain is not None %} You are about to set up the
+following domain: {{ domain }}{% endif %}
+{% if domain is None %}
 As we may need to contact you in the future, you need to verify your
 email address before you can use your account. To do so, please use
 the following link (valid for {{ link_expiration_hours }} hours):
-
+{% else %}
+To create your account and finish the registration, please confirm you
+received this email by clicking on the following link (valid for {{ link_expiration_hours }}
+hours):
+{% endif %}
 {{ confirmation_link }}
 
 After that, please follow the instructions on the confirmation page.

+ 1 - 1
api/desecapi/views.py

@@ -525,7 +525,7 @@ class AccountCreateView(generics.CreateAPIView):
                 link, validity_period = generate_confirmation_link(request,
                                                                    serializers.AuthenticatedActivateUserActionSerializer,
                                                                    'confirm-activate-account', user=user, domain=domain)
-                user.send_email('activate-with-domain' if domain else 'activate', context={
+                user.send_email('activate', context={
                     'confirmation_link': link,
                     'link_expiration_hours': validity_period // timedelta(hours=1),
                     'domain': domain,