mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2024-11-22 22:48:00 +00:00
fix user updating
This commit is contained in:
parent
ea0658e2ea
commit
a6f1738b73
|
@ -192,17 +192,20 @@ class Connection(SqlConnection):
|
|||
|
||||
def put_user(self, username: str, password: str | None, handle: str | None = None) -> Row:
|
||||
if self.get_user(username):
|
||||
data: dict[str, str | datetime | None] = {
|
||||
'username': username
|
||||
}
|
||||
data: dict[str, str] = {}
|
||||
|
||||
if password:
|
||||
data['password'] = password
|
||||
data['hash'] = self.hasher.hash(password)
|
||||
|
||||
if handle:
|
||||
data['handler'] = handle
|
||||
data['handle'] = handle
|
||||
|
||||
stmt = Update("users", data)
|
||||
stmt.set_where("username", username)
|
||||
|
||||
with self.query(stmt) as cur:
|
||||
return cur.one()
|
||||
|
||||
else:
|
||||
if password is None:
|
||||
raise ValueError('Password cannot be empty')
|
||||
|
||||
|
|
Loading…
Reference in a new issue