]> git.ipfire.org Git - ipfire.org.git/commitdiff
messages: Add HTML version of registration email
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 21 Nov 2019 11:33:51 +0000 (11:33 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 21 Nov 2019 11:33:51 +0000 (11:33 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/backend/messages.py
src/templates/auth/messages/register.html [new file with mode: 0644]
src/templates/auth/messages/register.txt

index 6f7497f2eb457561f81a6b8639d1696f7bd06be2..e4751f81da9d609964b78df83c8925ba987feae8 100644 (file)
@@ -129,6 +129,7 @@ templates_auth_messages_DATA = \
        src/templates/auth/messages/password-reset.txt \
        src/templates/auth/messages/profile-setup.txt \
        src/templates/auth/messages/profile-setup-2.txt \
+       src/templates/auth/messages/register.html \
        src/templates/auth/messages/register.txt
 
 templates_auth_messagesdir = $(templates_authdir)/messages
index 8063ce399ede36ebe042ea8ddf49468fb29fcbaa..69dbf802f545d1bba2f3027e5df210594bc93d80 100644 (file)
@@ -11,6 +11,7 @@ import tornado.template
 
 from . import accounts
 from . import misc
+from . import util
 from .decorators import *
 
 class Messages(misc.Object):
@@ -158,8 +159,19 @@ class Messages(misc.Object):
                """
                account = self.backend.accounts.get_by_mail(recipient)
 
-               return self.send_template(template, recipients=[recipient,],
-                       account=account)
+               kwargs = {
+                       "account"    : account,
+                       "first_name" : account.first_name,
+                       "last_name"  : account.last_name,
+                       "uid"        : account.uid,
+                       "email"      : account.email,
+
+                       # Random activation/reset codes
+                       "activation_code" : util.random_string(36),
+                       "reset_code"      : util.random_string(64),
+               }
+
+               return self.send_template(template, recipients=[recipient,], **kwargs)
 
 
 class Queue(misc.Object):
diff --git a/src/templates/auth/messages/register.html b/src/templates/auth/messages/register.html
new file mode 100644 (file)
index 0000000..75e0429
--- /dev/null
@@ -0,0 +1,33 @@
+{% extends "../../messages/base.html" %}
+
+{% block content %}
+    <p>
+        <strong>{{ _("Hello %s!") % first_name }}</strong>
+    </p>
+
+    <p>
+        {{ _("Thank you for registering a new account with us.") }}
+    </p>
+
+    <p>
+        {{ _("This account will allow you to take part in our project. Either by joining conversations, writing documentation, or becoming a developer.") }} {{ _("There are many things you can do with your account.") }}
+    </p>
+
+       <table role="presentation" border="0" cellpadding="0" cellspacing="0" class="btn btn-primary">
+               <tbody>
+                       <tr>
+                               <td align="left">
+                                       <table role="presentation" border="0" cellpadding="0" cellspacing="0">
+                                               <tbody>
+                                                       <tr>
+                                                               <td>
+                                    <a href="https://people.ipfire.org/activate/{{ uid }}/{{ activation_code }}" target="_blank">{{ _("Activate Account") }}</a>
+                                </td>
+                                                       </tr>
+                                               </tbody>
+                                       </table>
+                               </td>
+                       </tr>
+               </tbody>
+       </table>
+{% end block %}
index 4d2a02d0c188302d1815b5698ed2b8cd96b251bb..40c0f4a520747aa331565e75c2e9df3e8127b0f8 100644 (file)
@@ -4,7 +4,9 @@ Subject: {{ _("Please activate your account for the IPFire Project") }}
 
 {{ _("Hello %s!") % first_name }}
 
-{{ _("Thank you for registering a new account with us.") }} {{ _("This account will allow you to take part in our project. Either by joining conversations, writing documentation, or becoming a developer.") }} {{ _("There is many things you can do with your account.") }}
+{{ _("Thank you for registering a new account with us.") }}
+
+{{ _("This account will allow you to take part in our project. Either by joining conversations, writing documentation, or becoming a developer.") }} {{ _("There are many things you can do with your account.") }}
 
 {{ _("To activate it, please click on this link:") }}