-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I mean like "[2014-12-13 07:22:09,573] INFO [core.signals:11] login attempt for username 'Jennifer_Userton' failed"
- Loading branch information
1 parent
4fa534e
commit b2670bb
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from django.apps import AppConfig | ||
|
||
from core.signals import log_failed_login | ||
|
||
class FinetoothConfig(AppConfig): | ||
name = "core" | ||
verbose_name = "Finetooth Core" | ||
|
||
def ready(self): | ||
import core.signals | ||
|
||
default_app_config = "core.FinetoothConfig" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import logging | ||
|
||
from django.contrib.auth.signals import user_login_failed | ||
from django.dispatch import receiver | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
@receiver(user_login_failed) | ||
def log_failed_login(sender, **kwargs): | ||
logger.info("login attempt for username '{}' failed".format( | ||
kwargs['credentials']['username']) | ||
) |