comparison src/plugins/plugin_misc_account.py @ 1433:5d42e2219d7c

plugin misc_account: change the message sent by email after an account creation
author souliane <souliane@mailoo.org>
date Sat, 06 Jun 2015 17:01:22 +0200
parents 3265a2639182
children 200efadcab76
comparison
equal deleted inserted replaced
1432:60c41422ee48 1433:5d42e2219d7c
201 d.addCallback(setParams) 201 d.addCallback(setParams)
202 d.addErrback(removeProfile) 202 d.addErrback(removeProfile)
203 return d 203 return d
204 204
205 def _sendEmails(self, result, login, email, password): 205 def _sendEmails(self, result, login, email, password):
206 #time to send the email 206 # time to send the email
207 207
208 _email_host = self.getConfig('email_server') 208 _email_host = self.getConfig('email_server')
209 _email_from = self.getConfig("email_from") 209 _email_from = self.getConfig("email_from")
210 domain = self.getConfig('new_account_domain')
210 211
211 def email_ok(ignore): 212 def email_ok(ignore):
212 print ("Account creation email sent to %s" % email) 213 log.debug(u"Account creation email sent to %s" % email)
213 214
214 def email_ko(ignore): 215 def email_ko(ignore):
215 #TODO: return error code to user 216 # TODO: return error code to user
216 log.error(u"Failed to send email to %s" % email) 217 log.error(u"Failed to send email to %s" % email)
217 218
218 body = (u"""Welcome to Libervia, a Salut à Toi project part 219 body = (_(u"""Welcome to Libervia, the web interface of Salut à Toi.
219 220
220 /!\\ WARNING, THIS IS ONLY A TECHNICAL DEMO, DON'T USE THIS ACCOUNT FOR ANY SERIOUS PURPOSE /!\\ 221 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!
221 222
222 Here is your connection information: 223 Here is your connection information:
223 --- 224
224 login: %(login)s 225 Login on libervia.org: %(login)s
225 226 Jabber ID (JID): %(login)s@%(domain)s
226 Your Jabber ID (JID) is: %(jid)s 227
227 --- 228 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:
228 229
229 To try with some contacts, you can use the directory: subscribe in your parameters, and use it with the Communication/Search directory menu. 230 http://salut-a-toi.org/faq.html#certificate
230 231
231 SàT website: http://www.salut-a-toi.org 232 In the beginning, you have nobody to talk to. To find some contacts, use the users' directory:
232 follow SàT news: http://www.goffi.org 233 - make yourself visible in "Settings" / "Parameters" / "Directory".
233 234 - search for people with "Communication" / "Search directory".
234 Any feedback welcome 235
235 236 Any feedback welcome. Thank you!
236 Cheers 237
237 SàT team""" % {'login': login, 'jid': "%s@%s" % (login, self.getConfig('new_account_domain'))}).encode('utf-8') 238 Salut à Toi association
239 http://www.salut-a-toi.org
240 """) % {'login': login, 'domain': domain}).encode('utf-8')
238 msg = MIMEText(body, 'plain', 'UTF-8') 241 msg = MIMEText(body, 'plain', 'UTF-8')
239 msg['Subject'] = 'Libervia account created' 242 msg['Subject'] = _(u'Libervia account created')
240 msg['From'] = _email_from 243 msg['From'] = _email_from
241 msg['To'] = email 244 msg['To'] = email
242 245
243 d_user = sendmail(_email_host, _email_from, email, msg.as_string()) 246 d_user = sendmail(_email_host, _email_from, email, msg.as_string())
244 d_user.addCallbacks(email_ok, email_ko) 247 d_user.addCallbacks(email_ok, email_ko)
245 248
246 #email to the administrator 249 # email to the administrator
247 body = (u"""New account created: %(login)s [%(email)s]""" % {'login': login, 'email': email}).encode('utf-8') 250 body = (u"""New account created: %(login)s [%(email)s]""" % {'login': login, 'email': email}).encode('utf-8')
248 msg = MIMEText(body, 'plain', 'UTF-8') 251 msg = MIMEText(body, 'plain', 'UTF-8')
249 msg['Subject'] = 'Libervia new account created' 252 msg['Subject'] = _('New Libervia account created')
250 msg['From'] = _email_from 253 msg['From'] = _email_from
251 msg['To'] = self.getConfig('admin_email') 254 msg['To'] = self.getConfig('admin_email')
252 255
253 d_admin = sendmail(_email_host, _email_from, self.getConfig('admin_email'), msg.as_string()) 256 d_admin = sendmail(_email_host, _email_from, self.getConfig('admin_email'), msg.as_string())
254 d_admin.addCallbacks(email_ok, email_ko) 257 d_admin.addCallbacks(email_ok, email_ko)