mirror of
https://github.com/Casvt/MIND.git
synced 2026-04-03 03:00:22 -04:00
Added 2FA in the backend
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user