mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 10:56:06 -04:00
Fix unicode database support
This commit is contained in:
parent
0ba393924a
commit
0e8f5095c7
15 changed files with 88 additions and 44 deletions
|
@ -81,13 +81,23 @@ class RegistrationStore(SQLBaseStore):
|
|||
txn.execute("INSERT INTO access_tokens(user_id, token) " +
|
||||
"VALUES (?,?)", [user_id, token])
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def get_user_by_id(self, user_id):
|
||||
query = ("SELECT users.name, users.password_hash FROM users"
|
||||
" WHERE users.name = ?")
|
||||
return self._execute(
|
||||
"get_user_by_id", self.cursor_to_dict, query, user_id
|
||||
user_info = yield self._simple_select_one(
|
||||
table="users",
|
||||
keyvalues={
|
||||
"name": user_id,
|
||||
},
|
||||
retcols=["name", "password_hash"],
|
||||
allow_none=True,
|
||||
)
|
||||
|
||||
if user_info:
|
||||
user_info["password_hash"] = user_info["password_hash"].decode("utf8")
|
||||
|
||||
defer.returnValue(user_info)
|
||||
|
||||
|
||||
@cached()
|
||||
# TODO(paul): Currently there's no code to invalidate this cache. That
|
||||
# means if/when we ever add internal ways to invalidate access tokens or
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue