From e69149632f5168a02db141dc72ea143b467f54f4 Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Sat, 2 Mar 2024 17:52:01 -0500 Subject: [PATCH] frontend: fix namechange and password change failing --- core/data/schema/user.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/data/schema/user.py b/core/data/schema/user.py index f97bf3f..5f1ccf2 100644 --- a/core/data/schema/user.py +++ b/core/data/schema/user.py @@ -108,3 +108,15 @@ class UserData(BaseData): if result is None: return False return result.fetchall() + + async def change_password(self, user_id: int, new_passwd: str) -> bool: + sql = aime_user.update(aime_user.c.id == user_id).values(password = new_passwd) + + result = await self.execute(sql) + return result is not None + + async def change_username(self, user_id: int, new_name: str) -> bool: + sql = aime_user.update(aime_user.c.id == user_id).values(username = new_name) + + result = await self.execute(sql) + return result is not None