summary refs log tree commit diff
path: root/synapse/replication/http/login.py
diff options
context:
space:
mode:
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,