Added 2FA in the backend

This commit is contained in:
CasVT
2025-08-30 23:12:50 +02:00
parent 7456561a3a
commit aef883e0da
9 changed files with 212 additions and 78 deletions

View File

@@ -82,10 +82,13 @@ class User:
if self.user_db.taken(new_username):
raise UsernameTaken(new_username)
user_data = self.get()
self.user_db.update(
self.user_id,
new_username,
self.get().hash
user_data.hash,
user_data.mfa_apprise_url
)
LOGGER.info(
@@ -106,7 +109,8 @@ class User:
self.user_db.update(
self.user_id,
user_data.username,
hash_password
hash_password,
user_data.mfa_apprise_url
)
LOGGER.info(
@@ -114,6 +118,26 @@ class User:
)
return
def update_mfa_apprise_url(
self,
new_mfa_apprise_url: Union[str, None]
) -> None:
"""Change the MFA Apprise URL of the account.
Args:
new_mfa_apprise_url (Union[str, None]): The new MFA Apprise URL.
"""
user_data = self.get()
self.user_db.update(
self.user_id,
user_data.username,
user_data.hash,
new_mfa_apprise_url
)
return
def delete(self) -> None:
"""Delete the user. The instance should not be used after calling this
method.