You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add opt-in Retry-After header on lockout responses
Adds AXES_ENABLE_RETRY_AFTER_HEADER (default False). When enabled and a
cool-off is configured, lockout responses carry a Retry-After header with the
cool-off duration in seconds (RFC 7231).
Per review, the logic lives in axes.helpers as a small set_retry_after_header()
helper invoked from get_lockout_response, so the header is set in one place for
every built-in lockout response (JSON, template, redirect, default) and the
middleware needs no changes. A custom AXES_LOCKOUT_CALLABLE owns its response,
so it is left untouched. No cool-off (permanent lockout) means no header.
Closes the review feedback on #1401.
| AXES_HTTP_RESPONSE_CODE | 429 | Sets the http response code returned when ``AXES_FAILURE_LIMIT`` is reached. For example: ``AXES_HTTP_RESPONSE_CODE = 403`` |
| AXES_ENABLE_RETRY_AFTER_HEADER | False | If ``True``, Axes adds a ``Retry-After`` HTTP header to lockout responses when ``AXES_COOLOFF_TIME`` is configured. Set to ``False`` to disable it. |
| AXES_RESET_COOL_OFF_ON_FAILURE_DURING_LOCKOUT | True | If ``True``, any failed login attempt during lockout resets the cool-off timer to ``now() + AXES_COOLOFF_TIME``. Repeated failed attempts keep extending the lockout period. |
| AXES_LOCKOUT_PARAMETERS | ["ip_address"] | A list of parameters that Axes uses to lock out users. It can also be callable, which takes an http request or AccesAttempt object and credentials and returns a list of parameters. Each parameter can be a string (a single parameter) or a list of strings (a combined parameter). For example, if you configure ``AXES_LOCKOUT_PARAMETERS = ["ip_address", ["username", "user_agent"]]``, axes will block clients by ip and/or username and user agent combination. See :ref:`customizing-lockout-parameters` for more details. |
0 commit comments