Skip to content

Commit

Permalink
Adding ability to change http response code
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-bell authored and aleksihakli committed Aug 19, 2021
1 parent aec7018 commit 6858aea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions axes/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,6 @@
# set the callable for the readable string that can be used in
# e.g. logging to distinguish client requests
settings.AXES_CLIENT_STR_CALLABLE = getattr(settings, "AXES_CLIENT_STR_CALLABLE", None)

# set the HTTP response code given by too many requests
settings.AXES_HTTP_RESPONSE_CODE = getattr(settings, "AXES_HTTP_RESPONSE_CODE", 403)
2 changes: 1 addition & 1 deletion axes/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ def get_lockout_response(request, credentials: dict = None) -> HttpResponse:
"settings.AXES_LOCKOUT_CALLABLE needs to be a string, callable, or None."
)

status = 403
status = settings.AXES_HTTP_RESPONSE_CODE
context = {
"failure_limit": get_failure_limit(request, credentials),
"username": get_client_username(request, credentials) or "",
Expand Down

0 comments on commit 6858aea

Please sign in to comment.