mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 13:46:02 -04:00
Check users in our table aren't on a different domain to the one we're configured with to try & fix SYN-266
This commit is contained in:
parent
f46eee838a
commit
a7b51f4539
2 changed files with 37 additions and 0 deletions
|
@ -144,3 +144,21 @@ class RegistrationStore(SQLBaseStore):
|
|||
return rows[0]
|
||||
|
||||
raise StoreError(404, "Token not found.")
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def all_users_on_domain(self, domain):
|
||||
res = yield self.runInteraction(
|
||||
"all_users_on_domain",
|
||||
self._all_users_on_domain_txn,
|
||||
domain
|
||||
)
|
||||
defer.returnValue(res)
|
||||
|
||||
def _all_users_on_domain_txn(self, txn, domain):
|
||||
sql = "SELECT COUNT(*) FROM users WHERE name NOT LIKE ?"
|
||||
pat = "%:"+domain
|
||||
cursor = txn.execute(sql, (pat,))
|
||||
num_not_matching = cursor.fetchall()[0][0]
|
||||
if num_not_matching == 0:
|
||||
return True
|
||||
return False
|
Loading…
Add table
Add a link
Reference in a new issue