Add account settings page with options to update email, password and delete account

This commit is contained in:
Peter Stockings
2025-12-02 16:32:45 +11:00
parent d983854c7c
commit 814691c235
9 changed files with 347 additions and 13 deletions

24
db.py
View File

@@ -574,3 +574,27 @@ ORDER BY invocation_time DESC""", [http_function_id])
LIMIT %s""",
(user_id, limit)
)
def update_user_password(self, user_id, new_password_hash):
"""Update user's password"""
self.execute(
'UPDATE users SET password_hash=%s WHERE id=%s',
[new_password_hash, user_id],
commit=True
)
def update_user_email(self, user_id, new_email):
"""Update user's email address"""
self.execute(
'UPDATE users SET email=%s WHERE id=%s',
[new_email, user_id],
commit=True
)
def delete_user(self, user_id):
"""Delete a user account and all associated data"""
self.execute(
'DELETE FROM users WHERE id=%s',
[user_id],
commit=True
)