summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
Diffstat (limited to 'synapse')
-rw-r--r--synapse/rest/client/v2_alpha/account.py12
-rw-r--r--synapse/storage/registration.py11
2 files changed, 23 insertions, 0 deletions
diff --git a/synapse/rest/client/v2_alpha/account.py b/synapse/rest/client/v2_alpha/account.py
index 6045b016ef..5ac3ac0f71 100644
--- a/synapse/rest/client/v2_alpha/account.py
+++ b/synapse/rest/client/v2_alpha/account.py
@@ -89,6 +89,18 @@ class ThreepidRestServlet(RestServlet):
         self.auth = hs.get_auth()
 
     @defer.inlineCallbacks
+    def on_GET(self, request):
+        yield run_on_reactor()
+
+        auth_user, _ = yield self.auth.get_user_by_req(request)
+
+        threepids = yield self.hs.get_datastore().user_get_threepids(
+            auth_user.to_string()
+        )
+
+        defer.returnValue((200, {'threepids': threepids}))
+
+    @defer.inlineCallbacks
     def on_POST(self, request):
         yield run_on_reactor()
 
diff --git a/synapse/storage/registration.py b/synapse/storage/registration.py
index 8f62e5c6f2..08d60f0817 100644
--- a/synapse/storage/registration.py
+++ b/synapse/storage/registration.py
@@ -186,3 +186,14 @@ class RegistrationStore(SQLBaseStore):
             "validated_at": validated_at,
             "added_at": added_at,
         })
+
+    @defer.inlineCallbacks
+    def user_get_threepids(self, user_id):
+        ret = yield self._simple_select_list(
+            "user_threepids", {
+                "user": user_id
+            },
+            ['medium', 'address', 'validated_at', 'added_at'],
+            'user_get_threepids'
+        )
+        defer.returnValue(ret)
\ No newline at end of file