core: registerNewAccount partial fix
This commit is contained in:
parent
4d14048f8c
commit
eeff94469a
2 changed files with 5 additions and 7 deletions
|
|
@ -378,12 +378,12 @@ class SAT(service.Service):
|
|||
return None
|
||||
return self.profiles[profile].getHostJid()
|
||||
|
||||
def registerNewAccount(self, login, password, email, server, port=5222, id=None, profile_key='@NONE@'):
|
||||
def registerNewAccount(self, login, password, email, server, port=5222, id_=None, profile_key='@NONE@'):
|
||||
"""Connect to a server and create a new account using in-band registration"""
|
||||
profile = self.memory.getProfileName(profile_key)
|
||||
assert(profile)
|
||||
|
||||
next_id = id or sat_next_id() # the id is used to send server's answer
|
||||
next_id = id_ or self.get_next_id() # the id is used to send server's answer
|
||||
serverRegistrer = xmlstream.XmlStreamFactory(xmpp.RegisteringAuthenticator(self, server, login, password, email, next_id, profile))
|
||||
connector = reactor.connectTCP(server, port, serverRegistrer)
|
||||
serverRegistrer.clientConnectionLost = lambda conn, reason: connector.disconnect()
|
||||
|
|
@ -397,11 +397,9 @@ class SAT(service.Service):
|
|||
server = self.memory.getParamA("Server", "Connection", profile_key=profile)
|
||||
|
||||
if not user or not password or not server:
|
||||
info(_('No user or server given'))
|
||||
#TODO: a proper error message must be sent to frontend
|
||||
self.actionResult(id, "ERROR", {'message': _("No user, password or server given, can't register new account.")}, profile)
|
||||
return
|
||||
raise exceptions.DataError(_("No user, password or server given, can't register new account."))
|
||||
|
||||
# FIXME: to be fixed with XMLUI dialogs once their implemented
|
||||
confirm_id = sat_next_id()
|
||||
self.__private_data[confirm_id] = (id, profile)
|
||||
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ class Params(object):
|
|||
self.default_profile = None
|
||||
self.params = {}
|
||||
self.params_gen = {}
|
||||
host.registerCallback(host.registerNewAccountCB, force_id="registerNewAccount")
|
||||
host.registerCallback(host.registerNewAccountCB, with_data=True, force_id="registerNewAccount")
|
||||
|
||||
def createProfile(self, profile):
|
||||
"""Create a new profile
|
||||
|
|
|
|||
Loading…
Reference in a new issue