diff options
author | Daniel Wagner-Hall <daniel@matrix.org> | 2015-08-26 13:45:06 +0100 |
---|---|---|
committer | Daniel Wagner-Hall <daniel@matrix.org> | 2015-08-26 13:45:06 +0100 |
commit | 37f0ddca5fd932e091449f68b44428597dc8a309 (patch) | |
tree | ecd7714e4979d723d4cafe71623223a0e5ad5fd2 /synapse/storage | |
parent | Attempt to validate macaroons (diff) | |
parent | Merge erikj/user_dedup to develop (diff) | |
download | synapse-37f0ddca5fd932e091449f68b44428597dc8a309.tar.xz |
Merge branch 'mergeeriksmadness' into auth
Diffstat (limited to 'synapse/storage')
-rw-r--r-- | synapse/storage/registration.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/synapse/storage/registration.py b/synapse/storage/registration.py index a2d0f7c4b1..c9ceb132ae 100644 --- a/synapse/storage/registration.py +++ b/synapse/storage/registration.py @@ -120,6 +120,20 @@ class RegistrationStore(SQLBaseStore): allow_none=True, ) + def get_users_by_id_case_insensitive(self, user_id): + """Gets users that match user_id case insensitively. + Returns a mapping of user_id -> password_hash. + """ + def f(txn): + sql = ( + "SELECT name, password_hash FROM users" + " WHERE lower(name) = lower(?)" + ) + txn.execute(sql, (user_id,)) + return dict(txn.fetchall()) + + return self.runInteraction("get_users_by_id_case_insensitive", f) + @defer.inlineCallbacks def user_set_password_hash(self, user_id, password_hash): """ |