Merge erikj/user_dedup to develop

This commit is contained in:
Daniel Wagner-Hall 2015-08-26 13:42:45 +01:00
parent a2355fae7e
commit d3c0e48859
4 changed files with 50 additions and 12 deletions

View file

@ -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):
"""