Commit graph

565 commits

Author SHA1 Message Date
Nat Gordon
d4e97123f2 Add support to reset attempts on the cache handler 2021-02-15 20:20:49 +02:00
Aleksi Häkli
b6b26e492f Optimize imports as part of cleanup round 2021-01-07 18:23:33 +02:00
Aleksi Häkli
a5045f62fe Move tests outside project source folder 2021-01-07 18:23:33 +02:00
Hasan Ramezani
0eecff2e57 Use override_settings instead decorator context manager. 2021-01-06 23:46:54 +02:00
Clifton Barnes
d1cf5059e4 Fix formatting 2021-01-06 23:23:21 +02:00
Clifton Barnes
cff3a9254c Prevent cache entry for None username 2021-01-06 23:23:21 +02:00
Vladimir Knobel
64b53d55ae Black run on code to comply with py38-qa 2021-01-05 15:18:59 +02:00
Vladimir Knobel
cf51e09d75 Fix indentation 2021-01-05 15:18:59 +02:00
Vladimir Knobel
3d1e77298d Update conf.py
adds new AXES_ALLOWED_CORS_ORIGINS setting
2021-01-05 15:18:59 +02:00
Vladimir Knobel
55438c14bd Update helpers.py
chnage ALLOWED_CORS_ORIGINS to AXES_ALLOWED_CORS_ORIGINS
2021-01-05 15:18:59 +02:00
Vladimir Knobel
4a981f9972 Update helpers.py 2021-01-05 15:18:59 +02:00
Aleksi Häkli
10f6e621ce Add missing @wraps decorator
This keeps the original function name and docstring for the decorated function
2021-01-05 11:57:53 +02:00
Aleksi Häkli
1ba5c2bcbb
Remove unused imports 2021-01-04 19:02:04 +02:00
Hasan Ramezani
ab327f7b59 Add DEFAULT_AUTO_FIELD to test settings. 2021-01-04 18:13:43 +02:00
Aleksi Häkli
59bcbd8816 Move DRF integration into signals
Add documentation on how to enable the integration
and remove the logic from global middleware.

Fixes #673
2020-12-18 19:42:43 +02:00
Ashok Argent-Katwala
3a7d154f65 Adjust formatting to match the lint check. 2020-12-02 17:55:30 +02:00
Ashok Argent-Katwala
146d7a20b7 Only do the work in the middleware if axes is enabled. 2020-12-02 17:55:30 +02:00
Hasan Ramezani
22c564743d Prevent AccessAttempt creation for None username. 2020-11-05 20:06:49 +02:00
Anatoly
baf2349adb Apply Black for py36 2020-10-16 11:15:40 +03:00
Anatoly
d0a1338eb4 Update documentation of AxesMiddleware 2020-10-16 11:15:40 +03:00
Anatoly
f17971d339 Update documentation of AxesMiddleware 2020-10-16 11:15:40 +03:00
Anatoly
660963345a Cover AxesMiddleware with more tests 2020-10-16 11:15:40 +03:00
Anatoly
ae49f3bdae Update django request in the AxesMiddleware if drf is used 2020-10-16 11:15:40 +03: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
f213a87c00 Add @toggleable decorator to signal handler
Conform to the toggleable logic for the AccessAttempt event handling
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
4cac338138 Add AXES_LOGGER deprecation notice to checks 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
Aleksi Häkli
eedba80ef9 Roll back axes_reset_username style update 2020-09-20 22:00:59 +03:00
David Smith
baed1377f2 Split requirements files and bumped black/mypy versions 2020-09-17 15:06:07 +03:00
Aleksi Häkli
8b619dfdef Deprecate django-appconf 2020-09-12 17:03:50 +03:00
David Smith
d96a3e4625 black formatting 2020-09-11 11:03:15 +03:00
David Smith
96d34c1b95 request.is_ajax() is deprecated 2020-09-11 11:03:15 +03:00
David Smith
bf1f4eb360 Changed url() to path()
url() is deprecated in Django 3.1
2020-09-10 21:21:32 +03:00
David Smith
57a15116cd assertEquals() --> assertEqual()
assertEquals() is deprecated
2020-09-10 21:21:16 +03:00
Robert Rollins
98c404b442 Added comment describing the args the signal sends. 2020-08-21 17:18:45 +03:00
Robert Rollins
4986c240a6 Removed use of Signal()'s providing_args kwarg, as it is deprecated. 2020-08-21 17:18:45 +03:00
Petr Dlouhý
bf69a0a89e changes requested by aleksihakli 2020-08-21 17:17:57 +03:00
Petr Dlouhý
71ee9239d9 add missing tests; refactor reset_request() 2020-08-21 17:17:57 +03:00
Petr Dlouhý
576e666c54 fix tests on pypy 2020-08-21 17:17:57 +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
Petr Dlouhý
18c4edec29 test_login also with cache handler; refactor making cache key 2020-08-21 17:17:57 +03:00
Petr Dlouhý
c3c2786d57 add reset_request helper function to internalize reset logic into django-axis 2020-08-21 17:17:57 +03:00
Jorge Galvis
45109341be Make code Black's compliant. 2020-07-28 20:21:34 +03:00
Jorge Galvis
f772817bc8 Add some docstrings for guidance about creating new handlers. 2020-07-28 20:21:34 +03:00
Jorge Galvis
c786c53e9b Make all handlers to use the AxesBaseHandler mixin. 2020-07-28 20:21:34 +03:00
Jorge Galvis
87d8a974a3 Move signal's callbacks to AxesDatabaseHandler as they only make sense for a DB backend. 2020-07-28 20:21:34 +03:00
Jorge Galvis
9bb04a01b8 Only AxesHandler needs to follow a contract 2020-07-28 20:21:34 +03:00