summary refs log tree commit diff
path: root/synapse/replication/http/login.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-02-18 16:49:38 +0000
committerErik Johnston <erik@matrix.org>2019-02-18 16:49:38 +0000
commitaf691e415c3247b912137227a06a68d4c4356586 (patch)
treed106a17cd336ddd0683e027e64ab8b309c15447b /synapse/replication/http/login.py
parentUpdate docs (diff)
downloadsynapse-af691e415c3247b912137227a06a68d4c4356586.tar.xz
Move register_device into handler
Diffstat (limited to 'synapse/replication/http/login.py')
-rw-r--r--synapse/replication/http/login.py17
1 files changed, 3 insertions, 14 deletions
diff --git a/synapse/replication/http/login.py b/synapse/replication/http/login.py
index 797f6aabd1..1590eca317 100644
--- a/synapse/replication/http/login.py
+++ b/synapse/replication/http/login.py
@@ -35,9 +35,7 @@ class RegisterDeviceReplicationServlet(ReplicationEndpoint):
 
     def __init__(self, hs):
         super(RegisterDeviceReplicationServlet, self).__init__(hs)
-        self.auth_handler = hs.get_auth_handler()
-        self.device_handler = hs.get_device_handler()
-        self.macaroon_gen = hs.get_macaroon_generator()
+        self.registration_handler = hs.get_handlers().registration_handler
 
     @staticmethod
     def _serialize_payload(user_id, device_id, initial_display_name, is_guest):
@@ -62,19 +60,10 @@ class RegisterDeviceReplicationServlet(ReplicationEndpoint):
         initial_display_name = content["initial_display_name"]
         is_guest = content["is_guest"]
 
-        device_id = yield self.device_handler.check_device_registered(
-            user_id, device_id, initial_display_name,
+        device_id, access_token = yield self.registration_handler.register_device(
+            user_id, device_id, initial_display_name, is_guest,
         )
 
-        if is_guest:
-            access_token = self.macaroon_gen.generate_access_token(
-                user_id, ["guest = true"]
-            )
-        else:
-            access_token = yield self.auth_handler.get_access_token_for_user_id(
-                user_id, device_id=device_id,
-            )
-
         defer.returnValue((200, {
             "device_id": device_id,
             "access_token": access_token,