Add account settings page with options to update email, password and delete account
This commit is contained in:
24
db.py
24
db.py
@@ -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
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user