Mercurial > libervia-backend
comparison src/core/sat_main.py @ 813:1a1600491d9d
core: registerNewAccount partial fix
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 04 Feb 2014 18:54:06 +0100 |
parents | 1fe00f0c9a91 |
children | 2d901b7fa861 |
comparison
equal
deleted
inserted
replaced
812:084b52afdceb | 813:1a1600491d9d |
---|---|
376 profile = self.memory.getProfileName(profile_key) | 376 profile = self.memory.getProfileName(profile_key) |
377 if not profile: | 377 if not profile: |
378 return None | 378 return None |
379 return self.profiles[profile].getHostJid() | 379 return self.profiles[profile].getHostJid() |
380 | 380 |
381 def registerNewAccount(self, login, password, email, server, port=5222, id=None, profile_key='@NONE@'): | 381 def registerNewAccount(self, login, password, email, server, port=5222, id_=None, profile_key='@NONE@'): |
382 """Connect to a server and create a new account using in-band registration""" | 382 """Connect to a server and create a new account using in-band registration""" |
383 profile = self.memory.getProfileName(profile_key) | 383 profile = self.memory.getProfileName(profile_key) |
384 assert(profile) | 384 assert(profile) |
385 | 385 |
386 next_id = id or sat_next_id() # the id is used to send server's answer | 386 next_id = id_ or self.get_next_id() # the id is used to send server's answer |
387 serverRegistrer = xmlstream.XmlStreamFactory(xmpp.RegisteringAuthenticator(self, server, login, password, email, next_id, profile)) | 387 serverRegistrer = xmlstream.XmlStreamFactory(xmpp.RegisteringAuthenticator(self, server, login, password, email, next_id, profile)) |
388 connector = reactor.connectTCP(server, port, serverRegistrer) | 388 connector = reactor.connectTCP(server, port, serverRegistrer) |
389 serverRegistrer.clientConnectionLost = lambda conn, reason: connector.disconnect() | 389 serverRegistrer.clientConnectionLost = lambda conn, reason: connector.disconnect() |
390 | 390 |
391 return next_id | 391 return next_id |
395 user = jid.parse(self.memory.getParamA("JabberID", "Connection", profile_key=profile))[0] | 395 user = jid.parse(self.memory.getParamA("JabberID", "Connection", profile_key=profile))[0] |
396 password = self.memory.getParamA("Password", "Connection", profile_key=profile) | 396 password = self.memory.getParamA("Password", "Connection", profile_key=profile) |
397 server = self.memory.getParamA("Server", "Connection", profile_key=profile) | 397 server = self.memory.getParamA("Server", "Connection", profile_key=profile) |
398 | 398 |
399 if not user or not password or not server: | 399 if not user or not password or not server: |
400 info(_('No user or server given')) | 400 raise exceptions.DataError(_("No user, password or server given, can't register new account.")) |
401 #TODO: a proper error message must be sent to frontend | 401 |
402 self.actionResult(id, "ERROR", {'message': _("No user, password or server given, can't register new account.")}, profile) | 402 # FIXME: to be fixed with XMLUI dialogs once their implemented |
403 return | |
404 | |
405 confirm_id = sat_next_id() | 403 confirm_id = sat_next_id() |
406 self.__private_data[confirm_id] = (id, profile) | 404 self.__private_data[confirm_id] = (id, profile) |
407 | 405 |
408 self.askConfirmation( | 406 self.askConfirmation( |
409 confirm_id, "YES/NO", | 407 confirm_id, "YES/NO", |