diff options
author | Erik Johnston <erik@matrix.org> | 2015-09-03 09:54:08 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-09-03 09:54:08 +0100 |
commit | efeeff29f66f14fd4744413a3fd211d01e6c302a (patch) | |
tree | db5be4d096fdd045623017abffc7b67806c55c32 /synapse/handlers/identity.py | |
parent | hacky support for video for FS CC DD (diff) | |
parent | Change log level to info (diff) | |
download | synapse-efeeff29f66f14fd4744413a3fd211d01e6c302a.tar.xz |
Merge branch 'release-v0.10.0' v0.10.0
Diffstat (limited to 'synapse/handlers/identity.py')
-rw-r--r-- | synapse/handlers/identity.py | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/synapse/handlers/identity.py b/synapse/handlers/identity.py index 6200e10775..2a99921d5f 100644 --- a/synapse/handlers/identity.py +++ b/synapse/handlers/identity.py @@ -44,7 +44,7 @@ class IdentityHandler(BaseHandler): http_client = SimpleHttpClient(self.hs) # XXX: make this configurable! # trustedIdServers = ['matrix.org', 'localhost:8090'] - trustedIdServers = ['matrix.org'] + trustedIdServers = ['matrix.org', 'vector.im'] if 'id_server' in creds: id_server = creds['id_server'] @@ -117,3 +117,28 @@ class IdentityHandler(BaseHandler): except CodeMessageException as e: data = json.loads(e.msg) defer.returnValue(data) + + @defer.inlineCallbacks + def requestEmailToken(self, id_server, email, client_secret, send_attempt, **kwargs): + yield run_on_reactor() + http_client = SimpleHttpClient(self.hs) + + params = { + 'email': email, + 'client_secret': client_secret, + 'send_attempt': send_attempt, + } + params.update(kwargs) + + try: + data = yield http_client.post_urlencoded_get_json( + "https://%s%s" % ( + id_server, + "/_matrix/identity/api/v1/validate/email/requestToken" + ), + params + ) + defer.returnValue(data) + except CodeMessageException as e: + logger.info("Proxied requestToken failed: %r", e) + raise e |