Commit ff7eb235 authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

handle correctly when server return answer to register request when we create...

handle correctly when server return answer to register request when we create a new account. Fixes #1725
parent 4f6c6d3d
......@@ -156,14 +156,15 @@ class Connection(ConnectionHandlers):
if realm == common.xmpp.NS_REGISTER:
if event == common.xmpp.features_nb.REGISTER_DATA_RECEIVED:
# data is (agent, DataFrom, is_form)
if not data[1]: # wrong answer
self.dispatch('ERROR', (_('Invalid answer'),
_('Transport %s answered wrongly to register request.') % \
data[0]))
return
if self.new_account_info and\
self.new_account_info['hostname'] == data[0]:
#it's a new account
if not data[1]: # wrong answer
print self.connection.lastErr
self.dispatch('ACC_NOT_OK', (
_('Transport %s answered wrongly to register request.') % \
data[0]))
return
req = data[1].asDict()
req['username'] = self.new_account_info['name']
req['password'] = self.new_account_info['password']
......@@ -185,6 +186,11 @@ class Connection(ConnectionHandlers):
common.xmpp.features_nb.register(self.connection, data[0],
req, _on_register_result)
return
if not data[1]: # wrong answer
self.dispatch('ERROR', (_('Invalid answer'),
_('Transport %s answered wrongly to register request.') % \
data[0]))
return
is_form = data[2]
if is_form:
conf = self.parse_data_form(data[1])
......
......@@ -118,6 +118,7 @@ def getRegInfo(disp, host, info={}, sync=True):
def _ReceivedRegInfo(con, resp, agent):
iq=Iq('get',NS_REGISTER,to=agent)
if not isResultNode(resp):
con.Event(NS_REGISTER,REGISTER_DATA_RECEIVED,(agent,None,False))
return
tag=resp.getTag('query',namespace=NS_REGISTER)
if not tag:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment