idk i think it works
This commit is contained in:
@@ -57,6 +57,8 @@ async def edit_user(user_id: int, updates: dict):
|
||||
"""Edits an existing user."""
|
||||
if db.mode == "mysql":
|
||||
placeholders = ", ".join(["%s"] * len(updates))
|
||||
if updates.get("password") is not None: # there is a password update
|
||||
updates["password"] = bcrypt.hashpw(updates["password"].encode(), bcrypt.gensalt()).decode()
|
||||
values = list(updates.values())
|
||||
query = f"UPDATE users SET {', '.join([f'{key} = %s' for key in updates.keys()])} WHERE id = %s"
|
||||
values.append(user_id)
|
||||
|
||||
Reference in New Issue
Block a user