1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-22 13:34:04 +03:00

Fixed "resetData" whe user is deleted from db, so mfa storage can be freed

This commit is contained in:
Adolfo Gómez García 2023-02-23 15:10:04 +01:00
parent b14581c522
commit ac49786492
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23
2 changed files with 6 additions and 3 deletions

View File

@ -286,16 +286,14 @@ class MFA(Module):
raise exceptions.MFAError(err)
def reset_data(
def resetData(
self,
request: 'ExtendedHttpRequest',
userId: str,
) -> None:
"""
This method allows to reset the MFA state of an user.
Normally, this will do nothing, but for persistent MFA data (as Google Authenticator), this will remove the data.
"""
pass
@staticmethod

View File

@ -246,6 +246,11 @@ class User(UUIDModel):
# first, we invoke removeUser. If this raises an exception, user will not
# be removed
toDelete.getManager().removeUser(toDelete.name)
# If has mfa, remove related data
if toDelete.manager.mfa:
toDelete.manager.mfa.getInstance().resetData(toDelete)
# Remove related stored values
with storage.StorageAccess('manager' + str(toDelete.manager.uuid)) as store:
for key in store.keys():