All attempts that are logged are marked as trusted
and no other attempts are created in the code,
so having a flag that also uses a database index
is redundant and unnecessary.
Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
New Django deprecates six usage and the new
django-appconf version offers six internally,
being compatible with new Django versions.
Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
Most of our users are already running on Python 3.6+
and dropping 3.5 and below in a future oriented release
allows us to focus on implementing more readable codebases.
Fixes#417
Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
In order to offer backwards compatible import path for the
axes.utils.reset function it has to have a separate
implementation that can be imported independently from
the axes.helpers functions that are used by the
AxesBaseHandler implementation.
Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
A handler is always loaded if Axes is active,
and the dummy handler is intended for use when
the user wishes to use either the middleware
or authentication backends but does not want
Axes to handle or emit signals from
authentication events.
Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
Implement forwards compatibility for missing
django.utils.six package imports on Django 2.2
Relates to django-compressor/django-appconf#44
and can be removed after django-appconf
has received a new release which deprecates
the use of the integrated Django six library
Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
- Define a base handler API with method signatures
- Move proxy handler to a separate path for importability
- Implement a database handler with clean external dependencies
- Change the authentication backend and decorators to use the authentication backend
This enables clean pluggable authentication backend definitions that users
can override and specialize with e.g. cached handlers in their own packages.
Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
Clean up internal implementations and tests while keeping the
APIs as similar as possible where feasible.
The goal of this change is to not change any documented
or stable APIs that might be in use by users, but to improve
the internal implementations for maintainability and usability.
Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
- Cool off time was overly long on a number of test
- Cool off time on test was fetched with the wrong method
resulting in bugs on non-integer second cool off values
Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
- Move cache and cool off utility functions to the axes.utils module
- Clean up axes.attempts duplicate code in attempt and cache calculations
- Add stable implementation for AccessAttempt attribute calculation
in the axes.attempts.get_filter_kwargs function
Fixes#398
Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>