Commit graph

35 commits

Author SHA1 Message Date
Hasan Ramezani
c8f831bb62 Update prospector to 1.8.2 2022-12-03 14:12:51 +02:00
JensDiemer
ca42b0f7dc Bugfix #921 cannot import name 'get_distribution'
Replace `pkg_resources` with `importlib` solution to fix
https://github.com/jazzband/django-axes/issues/921

Because `importlib.metadata` is new in Python 3.8, fallback to old `setuptools` solution.
2022-11-14 18:25:06 +02:00
Aleksi Häkli
621dfa6882 Fix code formatting 2022-05-16 10:41:07 +03:00
Shaheed Haque
012fde1caf Refine and streamline startup log. The new output is on one line and
looks like this:

AXES: BEGIN version 5.32.1.dev14+g038dc7c.d20220507, blocking by IP only

Resolves #884.
2022-05-11 17:08:55 +03:00
Zakatell Kanda
876b6f3dc4 use autofield for now, otherwise we have to bump min version to 3.2 2021-06-09 19:35:29 +03:00
Zakatell Kanda
b4a71de81f use the new django bigautofield, fixes a warning 2021-06-09 19:35:29 +03:00
Aleksi Häkli
b6b26e492f Optimize imports as part of cleanup round 2021-01-07 18:23:33 +02:00
Aleksi Häkli
ce846bf4eb Fix GitHub code editor whitespaces 2020-09-27 17:08:01 +03:00
Aleksi Häkli
aae0e295ef Add QA skip for import ordering 2020-09-27 17:08:01 +03:00
Aleksi Häkli
122f387171 Adjust init verbose and enabled mode handling
Reduce complexity and leave the enabled mode to be used
with the toggleable decorator that disables functionality
when AXES_ENABLED is set to False for testing etc.

This conforms with the previous behaviour and logic flow.
2020-09-27 17:08:01 +03:00
Aleksi Häkli
00635d3ad0 Update initial module imports 2020-09-27 17:08:01 +03:00
Aleksi Häkli
b569cdb991 Deprecate settings.AXES_LOGGER configuration flag
Fixes #634

The Django import system seems to produce errors
in certain configurations and especially when
MIGRATION_MODULES configuration is set globally.

This is most probably caused by misbehaving or cyclic
Python module imports in the Django application
instrumentatation chain that come up when the
MIGRATION_MODULES configuration is altered.

This patch migrates to the standard Python logging system
use and has less overhead and complexity for users as well.

Having a configurable logging prefix does not produce
a lot of benefits and is less flexible than having
all individual module logging configurations accessible
through the module __name__ parameter in Axes.

For example axes.handlers.* or axes.backends.*
are separately configurable in the new scheme
whereas they would have been both bundled under
the AXES_LOGGER log configuration.
2020-09-26 21:44:56 +03:00
Petr Dlouhý
128d01158c add LOCK_OUT_BY_USER_OR_IP option
store all AccessAttempt records
2020-08-21 17:17:57 +03:00
Aleksi Häkli
93bb73552e
Upgrade CI tooling to use automatic code formatting 2019-09-28 19:28:17 +03:00
Aleksi Häkli
c30b2366cf
Migrate to setuptools_scm 2019-08-28 13:28:57 +03:00
Aleksi Häkli
a151b9c8e2 Add tests for AXES_ENABLED flag 2019-05-19 18:32:40 +03:00
Aleksi Häkli
83d2391250
Do not log Axes information on AXES_ENABLED = False 2019-05-08 14:01:06 +03:00
Aleksi Häkli
efe4e960b6
Run checks on application ready hook 2019-05-01 15:23:16 +03:00
Aleksi Häkli
42f8c86997
Improve handler design
Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-02-22 19:56:05 +02:00
Aleksi Häkli
e69d479f6a
Refactor handlers to a more pluggable format
- 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>
2019-02-22 19:55:57 +02:00
Aleksi Häkli
8b4c522f5b
Rename Axes appconfig startup method to initialize
Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-02-22 19:55:22 +02:00
Aleksi Häkli
42fe9c15fa
Unify import styling to use from ... imports 2019-02-13 14:05:24 +02:00
Aleksi Häkli
502434bbcb
Clean up logging initialization
Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-02-10 20:51:38 +02:00
Aleksi Häkli
a9e9b0d984
Pluggable signal handler backend for lockouts
Implements a proxied API which enables overriding
a handler backend with a user supplied implementation.

Fixes #399

Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-02-07 22:13:30 +02:00
Aleksi Häkli
030810df79
Drop Python 2.7 and Python 3.4 support
Fixes #395

Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-02-07 17:28:26 +02:00
Aleksi Häkli
99175dc57f
Use middleware, backends, and signals for lockouts
Fixes #389

Remove monkey-patching from the application loader phase
and use the Django authentication stack for lockout signals.

Utilize custom AUTHENTICATION_BACKENDS and MIDDLEWARE with signals
with backwards compatible implementation of features.

Update documentation, configuration and migration instructions
to match the new configuration and improve the code commentation.

Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-02-03 16:03:30 +02:00
Aleksi Häkli
9c328713e7
Use Django checks for cache configuration
Fixes #383

Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-02-03 16:03:28 +02:00
Aleksi Häkli
1013369ebe Clean up module imports 2018-04-21 00:33:44 +03:00
Aleksi Häkli
df8feb4f69
Backport unicode string literals for Python 2.7
Fixes #328
2018-04-18 15:21:09 +03:00
Aleksi Häkli
71a7a98529 Clean up apps setup errors and remove obsolete comments 2018-02-18 13:52:26 +02:00
JWvDronkelaar
a8b53667ed Ready check now considers AXES_CACHE setting 2018-02-17 16:06:27 +02:00
Aleksi Häkli
0afe300e41 Add default cache backend checks to avoid incorrect axes behaviour 2018-02-09 18:30:26 +02:00
Camilo Nova
726214df05 Added form_invalid decorator. Fixes #265 2017-11-21 16:51:59 -05:00
Camilo Nova
ba37442252 Added support for Django signals, big code refactor and improvements 2017-11-17 17:15:34 -05:00
Camilo Nova
730857a158 ☀️ Migrated from Middleware and added support for django 1.10 2016-06-24 11:31:01 -05:00