summary refs log tree commit diff
path: root/synapse/rest/client/login.py
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2022-05-04 14:11:21 -0400
committerGitHub <noreply@github.com>2022-05-04 14:11:21 -0400
commit7fbf42499d92ec3c9a05d9f36ec5fecd1ab1f18c (patch)
tree5f3a08745f204376a211aa3ece6f92f4108a9891 /synapse/rest/client/login.py
parentImplement changes to MSC2285 (hidden read receipts) (#12168) (diff)
downloadsynapse-7fbf42499d92ec3c9a05d9f36ec5fecd1ab1f18c.tar.xz
Use `getClientAddress` instead of `getClientIP`. (#12599)
getClientIP was deprecated in Twisted 18.4.0, which also added
getClientAddress. The Synapse minimum version for Twisted is
currently 18.9.0, so all supported versions have the new API.
Diffstat (limited to 'synapse/rest/client/login.py')
-rw-r--r--synapse/rest/client/login.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/synapse/rest/client/login.py b/synapse/rest/client/login.py
index 71d8038448..cf4196ac0a 100644
--- a/synapse/rest/client/login.py
+++ b/synapse/rest/client/login.py
@@ -176,7 +176,7 @@ class LoginRestServlet(RestServlet):
 
                 if appservice.is_rate_limited():
                     await self._address_ratelimiter.ratelimit(
-                        None, request.getClientIP()
+                        None, request.getClientAddress().host
                     )
 
                 result = await self._do_appservice_login(
@@ -188,19 +188,25 @@ class LoginRestServlet(RestServlet):
                 self.jwt_enabled
                 and login_submission["type"] == LoginRestServlet.JWT_TYPE
             ):
-                await self._address_ratelimiter.ratelimit(None, request.getClientIP())
+                await self._address_ratelimiter.ratelimit(
+                    None, request.getClientAddress().host
+                )
                 result = await self._do_jwt_login(
                     login_submission,
                     should_issue_refresh_token=should_issue_refresh_token,
                 )
             elif login_submission["type"] == LoginRestServlet.TOKEN_TYPE:
-                await self._address_ratelimiter.ratelimit(None, request.getClientIP())
+                await self._address_ratelimiter.ratelimit(
+                    None, request.getClientAddress().host
+                )
                 result = await self._do_token_login(
                     login_submission,
                     should_issue_refresh_token=should_issue_refresh_token,
                 )
             else:
-                await self._address_ratelimiter.ratelimit(None, request.getClientIP())
+                await self._address_ratelimiter.ratelimit(
+                    None, request.getClientAddress().host
+                )
                 result = await self._do_other_login(
                     login_submission,
                     should_issue_refresh_token=should_issue_refresh_token,