Commit 21bd3318 authored by Pratik Shrivastava's avatar Pratik Shrivastava

feat: add update password method

parent d93b5e06
...@@ -183,3 +183,18 @@ def add_new_user(user_info: dict, admin_id: int) -> int: ...@@ -183,3 +183,18 @@ def add_new_user(user_info: dict, admin_id: int) -> int:
db.session.add(new_user) db.session.add(new_user)
db.session.commit() db.session.commit()
return new_user.id return new_user.id
def update_password(user_id: int, new_password: str) -> bool | None:
try:
user_info: ORM.User = get_user_by_id(user_id)
user_info.password = new_password
db.session.commit()
return True
except Exception as e:
db.session.rollback()
raise e
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment