mirror of
https://github.com/jazzband/django-axes.git
synced 2026-05-08 15:44:46 +00:00
Fix py314-djqa CI checks
This commit is contained in:
parent
1c678ec087
commit
fd78bdfa20
2 changed files with 6 additions and 5 deletions
|
|
@ -42,7 +42,9 @@ class AxesMiddleware:
|
|||
@staticmethod
|
||||
def set_retry_after_header(request: HttpRequest, response: HttpResponse) -> None:
|
||||
if settings.AXES_ENABLE_RETRY_AFTER_HEADER:
|
||||
response["Retry-After"] = str(int(get_cool_off(request).total_seconds()))
|
||||
cool_off = get_cool_off(request)
|
||||
if cool_off is not None:
|
||||
response["Retry-After"] = str(int(cool_off.total_seconds()))
|
||||
|
||||
def build_lockout_response(
|
||||
self,
|
||||
|
|
@ -75,8 +77,6 @@ class AxesMiddleware:
|
|||
credentials = getattr(request, "axes_credentials", None)
|
||||
response = await sync_to_async(
|
||||
self.build_lockout_response, thread_sensitive=True
|
||||
)(
|
||||
request, response, credentials
|
||||
)
|
||||
)(request, response, credentials)
|
||||
|
||||
return response
|
||||
|
|
|
|||
|
|
@ -91,7 +91,8 @@ The following ``settings.py`` options are available for customizing Axes behavio
|
|||
+------------------------------------------------------+----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
.. note::
|
||||
If ``AXES_ENABLE_RETRY_AFTER_HEADER`` is enabled and ``AXES_COOLOFF_TIME`` is configured,
|
||||
``AXES_ENABLE_RETRY_AFTER_HEADER`` defaults to ``False``.
|
||||
If enabled and ``AXES_COOLOFF_TIME`` is configured,
|
||||
``AxesMiddleware`` adds a ``Retry-After`` HTTP header (`RFC 7231 <https://datatracker.ietf.org/doc/html/rfc7231#section-7.1.3>`_)
|
||||
with the cool-off duration in seconds for lockout responses.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue