core, plugin XEP-0077: in-band registration fix and move:

in-band was partially in core for historical reason, it has been moved to XEP-0077, and fixed. It is still incomplete, but should work for basic accounts creation.
This commit is contained in:
Goffi 2017-03-08 20:59:31 +01:00
commit d1ba64c780

View file

@ -1090,47 +1090,6 @@ class SatFallbackHandler(generic.FallbackHandler):
generic.FallbackHandler.iqFallback(self, iq)
class RegisteringAuthenticator(xmlstream.ConnectAuthenticator):
def __init__(self, host, jabber_host, user_login, user_pass, email, deferred, profile):
xmlstream.ConnectAuthenticator.__init__(self, jabber_host)
self.host = host
self.jabber_host = jabber_host
self.user_login = user_login
self.user_pass = user_pass
self.user_email = email
self.deferred = deferred
self.profile = profile
log.debug(_(u"Registration asked for %(user)s@%(host)s") % {'user': user_login, 'host': jabber_host})
def connectionMade(self):
log.debug(_(u"Connection made with %s" % self.jabber_host))
self.xmlstream.namespace = C.NS_CLIENT
self.xmlstream.sendHeader()
iq = xmlstream.IQ(self.xmlstream, 'set')
iq["to"] = self.jabber_host
query = iq.addElement(('jabber:iq:register', 'query'))
_user = query.addElement('username')
_user.addContent(self.user_login)
_pass = query.addElement('password')
_pass.addContent(self.user_pass)
if self.user_email:
_email = query.addElement('email')
_email.addContent(self.user_email)
d = iq.send(self.jabber_host).addCallbacks(self.registrationAnswer, self.registrationFailure)
d.chainDeferred(self.deferred)
def registrationAnswer(self, answer):
log.debug(_(u"Registration answer: %s") % answer.toXml())
self.xmlstream.sendFooter()
def registrationFailure(self, failure_):
log.info(_("Registration failure: %s") % unicode(failure_.value))
self.xmlstream.sendFooter()
raise failure_.value
class SatVersionHandler(generic.VersionHandler):
def getDiscoInfo(self, requestor, target, node):