diff options
author | David Baker <dbkr@matrix.org> | 2014-11-20 18:25:31 +0000 |
---|---|---|
committer | David Baker <dbkr@matrix.org> | 2014-11-20 18:25:31 +0000 |
commit | 58f82e2e5484e9a83d0c184747442ac887e3b5d7 (patch) | |
tree | fb93f00e8ba6334d2a524d530e0bbf581fd76d25 /synapse/handlers | |
parent | Merge branch 'develop' into pushers (diff) | |
parent | Fix pep8 and pyflakes warnings (diff) | |
download | synapse-58f82e2e5484e9a83d0c184747442ac887e3b5d7.tar.xz |
Merge branch 'develop' into pushers
Diffstat (limited to 'synapse/handlers')
-rw-r--r-- | synapse/handlers/login.py | 13 | ||||
-rw-r--r-- | synapse/handlers/register.py | 23 |
2 files changed, 23 insertions, 13 deletions
diff --git a/synapse/handlers/login.py b/synapse/handlers/login.py index 1204dc3b8f..c98ae2cfb5 100644 --- a/synapse/handlers/login.py +++ b/synapse/handlers/login.py @@ -23,7 +23,6 @@ import synapse.util.emailutils as emailutils import bcrypt import logging -import urllib logger = logging.getLogger(__name__) @@ -99,8 +98,14 @@ class LoginHandler(BaseHandler): def _query_email(self, email): httpCli = SimpleHttpClient(self.hs) data = yield httpCli.get_json( - 'matrix.org:8090', # TODO FIXME This should be configurable. - "/_matrix/identity/api/v1/lookup?medium=email&address=" + - "%s" % urllib.quote(email) + # TODO FIXME This should be configurable. + # XXX: ID servers need to use HTTPS + "http://%s%s" % ( + "matrix.org:8090", "/_matrix/identity/api/v1/lookup" + ), + { + 'medium': 'email', + 'address': email + } ) defer.returnValue(data) diff --git a/synapse/handlers/register.py b/synapse/handlers/register.py index 122bf065c9..48c326ebf0 100644 --- a/synapse/handlers/register.py +++ b/synapse/handlers/register.py @@ -133,7 +133,7 @@ class RegistrationHandler(BaseHandler): if not threepid: raise RegistrationError(400, "Couldn't validate 3pid") - logger.info("got threepid medium %s address %s", + logger.info("got threepid with medium '%s' and address '%s'", threepid['medium'], threepid['address']) @defer.inlineCallbacks @@ -167,8 +167,11 @@ class RegistrationHandler(BaseHandler): 'credentials', creds['idServer']) defer.returnValue(None) data = yield httpCli.get_json( - creds['idServer'], - "/_matrix/identity/api/v1/3pid/getValidated3pid", + # XXX: This should be HTTPS + "http://%s%s" % ( + creds['idServer'], + "/_matrix/identity/api/v1/3pid/getValidated3pid" + ), {'sid': creds['sid'], 'clientSecret': creds['clientSecret']} ) @@ -178,16 +181,21 @@ class RegistrationHandler(BaseHandler): @defer.inlineCallbacks def _bind_threepid(self, creds, mxid): + yield + logger.debug("binding threepid") httpCli = SimpleHttpClient(self.hs) data = yield httpCli.post_urlencoded_get_json( - creds['idServer'], - "/_matrix/identity/api/v1/3pid/bind", + # XXX: Change when ID servers are all HTTPS + "http://%s%s" % ( + creds['idServer'], "/_matrix/identity/api/v1/3pid/bind" + ), { 'sid': creds['sid'], 'clientSecret': creds['clientSecret'], 'mxid': mxid, } ) + logger.debug("bound threepid") defer.returnValue(data) @defer.inlineCallbacks @@ -215,10 +223,7 @@ class RegistrationHandler(BaseHandler): # each request client = CaptchaServerHttpClient(self.hs) data = yield client.post_urlencoded_get_raw( - "www.google.com:80", - "/recaptcha/api/verify", - # twisted dislikes google's response, no content length. - accept_partial=True, + "http://www.google.com:80/recaptcha/api/verify", args={ 'privatekey': private_key, 'remoteip': ip_addr, |