mirror of
https://github.com/jazzband/django-defender.git
synced 2026-05-13 01:53:14 +00:00
Always define the task to store login attempt
Adding function definitions based on config values makes testing hard. The task function is always there, and we choose to call it depending on config during runtime.
This commit is contained in:
parent
f9047162d4
commit
831bb299f9
1 changed files with 8 additions and 9 deletions
|
|
@ -1,15 +1,14 @@
|
|||
from . import config
|
||||
from .data import store_login_attempt
|
||||
|
||||
# not sure how to get this to look better. ideally we want to dynamically
|
||||
# apply the celery decorator based on the USE_CELERY setting.
|
||||
|
||||
if config.USE_CELERY:
|
||||
from celery import shared_task
|
||||
from celery import shared_task
|
||||
|
||||
@shared_task()
|
||||
def add_login_attempt_task(user_agent, ip_address, username,
|
||||
http_accept, path_info, login_valid):
|
||||
""" Create a record for the login attempt """
|
||||
store_login_attempt(user_agent, ip_address, username,
|
||||
http_accept, path_info, login_valid)
|
||||
|
||||
@shared_task()
|
||||
def add_login_attempt_task(user_agent, ip_address, username,
|
||||
http_accept, path_info, login_valid):
|
||||
""" Create a record for the login attempt """
|
||||
store_login_attempt(user_agent, ip_address, username,
|
||||
http_accept, path_info, login_valid)
|
||||
|
|
|
|||
Loading…
Reference in a new issue