From fdad3cf3c950249883fbfe136a952002dc69ece8 Mon Sep 17 00:00:00 2001 From: souliane Date: Sat, 6 Jun 2015 17:01:22 +0200 Subject: [PATCH] plugin misc_account: change the message sent by email after an account creation --- src/plugins/plugin_misc_account.py | 39 ++++++++++++++++-------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/src/plugins/plugin_misc_account.py b/src/plugins/plugin_misc_account.py index 9595f7aa..e453302a 100755 --- a/src/plugins/plugin_misc_account.py +++ b/src/plugins/plugin_misc_account.py @@ -203,50 +203,53 @@ class MiscAccount(object): return d def _sendEmails(self, result, login, email, password): - #time to send the email + # time to send the email _email_host = self.getConfig('email_server') _email_from = self.getConfig("email_from") + domain = self.getConfig('new_account_domain') def email_ok(ignore): - print ("Account creation email sent to %s" % email) + log.debug(u"Account creation email sent to %s" % email) def email_ko(ignore): - #TODO: return error code to user + # TODO: return error code to user log.error(u"Failed to send email to %s" % email) - body = (u"""Welcome to Libervia, a Salut à Toi project part + body = (_(u"""Welcome to Libervia, the web interface of Salut à Toi. -/!\\ WARNING, THIS IS ONLY A TECHNICAL DEMO, DON'T USE THIS ACCOUNT FOR ANY SERIOUS PURPOSE /!\\ +Your account on %(domain)s has been successfully created. This is a demonstration version to show you the current status of the project. It is still under development, it misses some features and it's not stable enough to be used for any serious purpose. Please keep it in mind! Here is your connection information: ---- -login: %(login)s -Your Jabber ID (JID) is: %(jid)s ---- +Login on libervia.org: %(login)s +Jabber ID (JID): %(login)s@%(domain)s -To try with some contacts, you can use the directory: subscribe in your parameters, and use it with the Communication/Search directory menu. +Your password has been chosen by yourself. If you haven't read our security notice regarding the connection to https://libervia.org, please do it now: -SàT website: http://www.salut-a-toi.org -follow SàT news: http://www.goffi.org +http://salut-a-toi.org/faq.html#certificate -Any feedback welcome +In the beginning, you have nobody to talk to. To find some contacts, use the users' directory: + - make yourself visible in "Settings" / "Parameters" / "Directory". + - search for people with "Communication" / "Search directory". -Cheers -SàT team""" % {'login': login, 'jid': "%s@%s" % (login, self.getConfig('new_account_domain'))}).encode('utf-8') +Any feedback welcome. Thank you! + +Salut à Toi association +http://www.salut-a-toi.org +""") % {'login': login, 'domain': domain}).encode('utf-8') msg = MIMEText(body, 'plain', 'UTF-8') - msg['Subject'] = 'Libervia account created' + msg['Subject'] = _(u'Libervia account created') msg['From'] = _email_from msg['To'] = email d_user = sendmail(_email_host, _email_from, email, msg.as_string()) d_user.addCallbacks(email_ok, email_ko) - #email to the administrator + # email to the administrator body = (u"""New account created: %(login)s [%(email)s]""" % {'login': login, 'email': email}).encode('utf-8') msg = MIMEText(body, 'plain', 'UTF-8') - msg['Subject'] = 'Libervia new account created' + msg['Subject'] = _('New Libervia account created') msg['From'] = _email_from msg['To'] = self.getConfig('admin_email')