stages/authenticator_duo: remove signals
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
dff0613b3d
commit
5b7e1f97e0
|
@ -1,6 +1,4 @@
|
||||||
"""TOTP"""
|
"""TOTP"""
|
||||||
from importlib import import_module
|
|
||||||
|
|
||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,6 +8,3 @@ class AuthentikStageAuthenticatorTOTPConfig(AppConfig):
|
||||||
name = "authentik.stages.authenticator_totp"
|
name = "authentik.stages.authenticator_totp"
|
||||||
label = "authentik_stages_authenticator_totp"
|
label = "authentik_stages_authenticator_totp"
|
||||||
verbose_name = "authentik Stages.Authenticator.TOTP"
|
verbose_name = "authentik Stages.Authenticator.TOTP"
|
||||||
|
|
||||||
def ready(self):
|
|
||||||
import_module("authentik.stages.authenticator_totp.signals")
|
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
"""totp authenticator signals"""
|
|
||||||
from django.db.models.signals import pre_delete
|
|
||||||
from django.dispatch import receiver
|
|
||||||
from django_otp.plugins.otp_totp.models import TOTPDevice
|
|
||||||
|
|
||||||
from authentik.events.models import Event
|
|
||||||
|
|
||||||
|
|
||||||
@receiver(pre_delete, sender=TOTPDevice)
|
|
||||||
# pylint: disable=unused-argument
|
|
||||||
def pre_delete_event(sender, instance: TOTPDevice, **_):
|
|
||||||
"""Create event before deleting TOTP Devices"""
|
|
||||||
# Create event with email notification
|
|
||||||
event = Event.new("totp_disable", message="User disabled Time-based OTP.")
|
|
||||||
event.set_user(instance.user)
|
|
||||||
event.save()
|
|
Reference in New Issue