plugin misc_account: fixes two bugs introduced by revision 1907 (0b748ad46ede):
- the email sent to the user was not displaying its his/her JID
- creating an account from an external JID was not returning a bool
This commit is contained in:
parent
ed403ebe9f
commit
30e4e3559f
1 changed files with 9 additions and 3 deletions
|
|
@ -222,7 +222,7 @@ class MiscAccount(object):
|
||||||
@return Deferred
|
@return Deferred
|
||||||
"""
|
"""
|
||||||
d = self.createProfile(password, jid_s, profile)
|
d = self.createProfile(password, jid_s, profile)
|
||||||
d.addCallback(lambda dummy: self.sendEmails(email, jid_s, password, profile))
|
d.addCallback(lambda dummy: self.sendEmails(email, profile))
|
||||||
return d
|
return d
|
||||||
|
|
||||||
def createProfile(self, password, jid_s, profile):
|
def createProfile(self, password, jid_s, profile):
|
||||||
|
|
@ -278,7 +278,7 @@ class MiscAccount(object):
|
||||||
d.addErrback(removeProfile)
|
d.addErrback(removeProfile)
|
||||||
return d
|
return d
|
||||||
|
|
||||||
def sendEmails(self, email, jid_s, password, profile):
|
def sendEmails(self, email, profile):
|
||||||
# time to send the email
|
# time to send the email
|
||||||
|
|
||||||
email_host = self.getConfig('email_server')
|
email_host = self.getConfig('email_server')
|
||||||
|
|
@ -322,6 +322,7 @@ class MiscAccount(object):
|
||||||
if not email:
|
if not email:
|
||||||
return d_admin
|
return d_admin
|
||||||
|
|
||||||
|
jid_s = self.host.memory.getParamA("JabberID", "Connection", profile_key=profile)
|
||||||
body = (_(u"""Welcome to Libervia, the web interface of Salut à Toi.
|
body = (_(u"""Welcome to Libervia, the web interface of Salut à Toi.
|
||||||
|
|
||||||
Your account on {domain} has been successfully created. This is a demonstration version to show you the current status of the project. It is still under development, please keep it in mind!
|
Your account on {domain} has been successfully created. This is a demonstration version to show you the current status of the project. It is still under development, please keep it in mind!
|
||||||
|
|
@ -618,6 +619,11 @@ http://www.salut-a-toi.org
|
||||||
d.addCallback(lambda dummy: self.host.memory.getProfileName(jid_s)) # checks if the profile has been successfuly created
|
d.addCallback(lambda dummy: self.host.memory.getProfileName(jid_s)) # checks if the profile has been successfuly created
|
||||||
d.addCallback(self.host.asyncConnect, password, 0)
|
d.addCallback(self.host.asyncConnect, password, 0)
|
||||||
|
|
||||||
|
|
||||||
|
def connected(result):
|
||||||
|
self.sendEmails(None, profile=jid_s)
|
||||||
|
return result
|
||||||
|
|
||||||
def removeProfile(failure): # profile has been successfully created but the XMPP credentials are wrong!
|
def removeProfile(failure): # profile has been successfully created but the XMPP credentials are wrong!
|
||||||
log.debug("Removing previously auto-created profile: %s" % failure.getErrorMessage())
|
log.debug("Removing previously auto-created profile: %s" % failure.getErrorMessage())
|
||||||
self.host.memory.asyncDeleteProfile(jid_s)
|
self.host.memory.asyncDeleteProfile(jid_s)
|
||||||
|
|
@ -626,5 +632,5 @@ http://www.salut-a-toi.org
|
||||||
# FIXME: we don't catch the case where the JID host is not an XMPP server, and the user
|
# FIXME: we don't catch the case where the JID host is not an XMPP server, and the user
|
||||||
# has to wait until the DBUS timeout ; as a consequence, emails are sent to the admins
|
# has to wait until the DBUS timeout ; as a consequence, emails are sent to the admins
|
||||||
# and the profile is not deleted. When the host exists, removeProfile is well called.
|
# and the profile is not deleted. When the host exists, removeProfile is well called.
|
||||||
d.addCallbacks(lambda dummy: self.sendEmails(None, jid_s, password, jid_s), removeProfile)
|
d.addCallbacks(connected, removeProfile)
|
||||||
return d
|
return d
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue