From: Michael Tremer Date: Thu, 21 Nov 2019 11:33:51 +0000 (+0000) Subject: messages: Add HTML version of registration email X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0218bd0d157ee2b2a0ad845e9ff8e7df96f78a20;p=ipfire.org.git messages: Add HTML version of registration email Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index 6f7497f2..e4751f81 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/src/backend/messages.py b/src/backend/messages.py index 8063ce39..69dbf802 100644 --- a/src/backend/messages.py +++ b/src/backend/messages.py @@ -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 index 00000000..75e0429d --- /dev/null +++ b/src/templates/auth/messages/register.html @@ -0,0 +1,33 @@ +{% extends "../../messages/base.html" %} + +{% block content %} +

+ {{ _("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 are many things you can do with your account.") }} +

+ + + + + + + + +{% end block %} diff --git a/src/templates/auth/messages/register.txt b/src/templates/auth/messages/register.txt index 4d2a02d0..40c0f4a5 100644 --- a/src/templates/auth/messages/register.txt +++ b/src/templates/auth/messages/register.txt @@ -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:") }}