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:
parent
b14581c522
commit
ac49786492
@ -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
|
||||
|
@ -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():
|
||||
|
Loading…
Reference in New Issue
Block a user