SIGNAL_ACCOUNT_POST_LOGIN_FAIL is now properly used. Added a CUSTOM_SIGNALS event handler to signals.py
This commit is contained in:
parent
f6b43b0416
commit
ad6d9a98ff
2 changed files with 6 additions and 0 deletions
|
|
@ -33,6 +33,7 @@ from evennia.server.signals import (
|
||||||
SIGNAL_ACCOUNT_POST_CREATE,
|
SIGNAL_ACCOUNT_POST_CREATE,
|
||||||
SIGNAL_OBJECT_POST_PUPPET,
|
SIGNAL_OBJECT_POST_PUPPET,
|
||||||
SIGNAL_OBJECT_POST_UNPUPPET,
|
SIGNAL_OBJECT_POST_UNPUPPET,
|
||||||
|
SIGNAL_ACCOUNT_POST_LOGIN_FAIL,
|
||||||
)
|
)
|
||||||
from evennia.server.throttle import Throttle
|
from evennia.server.throttle import Throttle
|
||||||
from evennia.typeclasses.attributes import ModelAttributeBackend, NickHandler
|
from evennia.typeclasses.attributes import ModelAttributeBackend, NickHandler
|
||||||
|
|
@ -673,6 +674,7 @@ class DefaultAccount(AccountDB, metaclass=TypeclassBase):
|
||||||
if session:
|
if session:
|
||||||
account = AccountDB.objects.get_account_from_name(username)
|
account = AccountDB.objects.get_account_from_name(username)
|
||||||
if account:
|
if account:
|
||||||
|
SIGNAL_ACCOUNT_POST_LOGIN_FAIL.send(sender=account, session=session)
|
||||||
account.at_failed_login(session)
|
account.at_failed_login(session)
|
||||||
|
|
||||||
return None, errors
|
return None, errors
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ without necessitating a full takeover of hooks that may be in high demand.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from django.dispatch import Signal
|
from django.dispatch import Signal
|
||||||
|
from collections import defaultdict
|
||||||
|
|
||||||
# The sender is the created Account. This is triggered at the very end of
|
# The sender is the created Account. This is triggered at the very end of
|
||||||
# Account.create() after the Account is created. Note that this will *not* fire
|
# Account.create() after the Account is created. Note that this will *not* fire
|
||||||
|
|
@ -91,6 +92,9 @@ SIGNAL_CHANNEL_POST_CREATE = Signal()
|
||||||
# Called just after at_traverse hook.
|
# Called just after at_traverse hook.
|
||||||
SIGNAL_EXIT_TRAVERSED = Signal()
|
SIGNAL_EXIT_TRAVERSED = Signal()
|
||||||
|
|
||||||
|
# Used as a generic event emitter. Use to make your own signals easily in one place!
|
||||||
|
SIGNALS_CUSTOM: dict[str, Signal] = defaultdict(Signal)
|
||||||
|
|
||||||
# Django default signals (https://docs.djangoproject.com/en/4.1/topics/signals/)
|
# Django default signals (https://docs.djangoproject.com/en/4.1/topics/signals/)
|
||||||
|
|
||||||
from django.core.signals import request_finished # " ends.
|
from django.core.signals import request_finished # " ends.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue