Skip to content

Commit

Permalink
chore!: use AXES_LOCKOUT_PARAMETERS in app init log message
Browse files Browse the repository at this point in the history
hirotasoshu authored and wannacfuture committed May 13, 2023
1 parent 72add39 commit ab53175
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions axes/apps.py
Original file line number Diff line number Diff line change
@@ -33,14 +33,22 @@ def initialize(cls):

# Skip startup log messages if Axes is not set to verbose
if settings.AXES_VERBOSE:
if settings.AXES_ONLY_USER_FAILURES:
mode = "blocking by username only"
elif settings.AXES_LOCK_OUT_BY_COMBINATION_USER_AND_IP:
mode = "blocking by combination of username and IP"
elif settings.AXES_LOCK_OUT_BY_USER_OR_IP:
mode = "blocking by username or IP"

if callable(settings.AXES_LOCKOUT_PARAMETERS) or isinstance(
settings.AXES_LOCKOUT_PARAMETERS, str
):
mode = "blocking by parameters that are calculated in a custom callable"

else:
mode = "blocking by IP only"
mode = "blocking by " + " or ".join(
[
param
if isinstance(param, str)
else "combination of " + " and ".join(param)
for param in settings.AXES_LOCKOUT_PARAMETERS
]
)

log.info(
"AXES: BEGIN version %s, %s",
__version__,

0 comments on commit ab53175

Please sign in to comment.