Add ability to update user's data
- Password - Access token
This commit is contained in:
parent
b406a9a3c8
commit
85c07ed4f3
3 changed files with 41 additions and 1 deletions
19
dba.py
19
dba.py
|
|
@ -96,6 +96,25 @@ def create_user(conn: DBConnector, username: str, password: str):
|
|||
return False, e
|
||||
|
||||
|
||||
def update_user(conn: DBConnector, id: int, password: str, access_token: str):
|
||||
try:
|
||||
hashedPwd = hash_password(password)
|
||||
conn.updateDataInTable(
|
||||
USERS_TABLE_NAME,
|
||||
[
|
||||
ColumnUpdate("password", hashedPwd),
|
||||
ColumnUpdate("access_token", access_token),
|
||||
],
|
||||
[
|
||||
ColumnCondition("id", id),
|
||||
],
|
||||
)
|
||||
return True, None
|
||||
except Exception as e:
|
||||
logger.exception(e)
|
||||
return False, e
|
||||
|
||||
|
||||
def get_user_by_username(conn: DBConnector, username: str):
|
||||
try:
|
||||
users = conn.filterFromTable(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue