summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorMark Haines <mjark@negativecurvature.net>2015-08-20 10:04:04 +0100
committerMark Haines <mjark@negativecurvature.net>2015-08-20 10:04:04 +0100
commita0b8e5f2fec1982af20fdafc454047067058fd51 (patch)
treee6b02b94d49fc3ddb3c5ee7793bbc729e3fb5027 /synapse/handlers
parentMerge pull request #232 from matrix-org/erikj/appservice_joined_rooms (diff)
parentCheck absent before trying to access keys (diff)
downloadsynapse-a0b8e5f2fec1982af20fdafc454047067058fd51.tar.xz
Merge pull request #211 from matrix-org/email_in_use
Changes for unique emails
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/identity.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/synapse/handlers/identity.py b/synapse/handlers/identity.py
index c1095708a0..2a99921d5f 100644
--- a/synapse/handlers/identity.py
+++ b/synapse/handlers/identity.py
@@ -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