summary refs log tree commit diff
path: root/synapse/api/auth.py
diff options
context:
space:
mode:
authorNeil Johnson <neil@matrix.org>2018-08-31 10:49:14 +0100
committerNeil Johnson <neil@matrix.org>2018-08-31 10:49:14 +0100
commitea068d6f3cd5ed1bc9a39b2fd43e19d6d40f18da (patch)
tree149068aa0096858c2ad9ff661da4b5108f3a8f98 /synapse/api/auth.py
parentPort storage/ to Python 3 (#3725) (diff)
downloadsynapse-ea068d6f3cd5ed1bc9a39b2fd43e19d6d40f18da.tar.xz
fix bug where preserved threepid user comes to sign up and server is mau blocked
Diffstat (limited to 'synapse/api/auth.py')
-rw-r--r--synapse/api/auth.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/synapse/api/auth.py b/synapse/api/auth.py
index a7e3f7a7ac..9c207b9537 100644
--- a/synapse/api/auth.py
+++ b/synapse/api/auth.py
@@ -775,7 +775,7 @@ class Auth(object):
             )
 
     @defer.inlineCallbacks
-    def check_auth_blocking(self, user_id=None):
+    def check_auth_blocking(self, user_id=None, threepid=None):
         """Checks if the user should be rejected for some external reason,
         such as monthly active user limiting or global disable flag
 
@@ -806,6 +806,14 @@ class Auth(object):
                 is_trial = yield self.store.is_trial_user(user_id)
                 if is_trial:
                     return
+            elif threepid:
+                # If the user does not exist yet, but is signing up with a
+                # reserved threepid then pass auth check
+                for tp in self.hs.config.mau_limits_reserved_threepids:
+                    if (threepid['medium'] == tp['medium']
+                            and threepid['address'] == tp['address']):
+                        return
+
             # Else if there is no room in the MAU bucket, bail
             current_mau = yield self.store.get_monthly_active_count()
             if current_mau >= self.hs.config.max_mau_value: