Commit graph

25 commits

Author SHA1 Message Date
Aleksi Häkli
621dfa6882 Fix code formatting 2022-05-16 10:41:07 +03:00
Aleksi Häkli
fffb539c32 Fix proxy handler false negative errors for pylint 2022-05-16 10:41:07 +03:00
Hasan Ramezani
4da7eb9fc1 Add Optional to type of params with default value equal to None 2022-04-13 17:48:32 +03:00
Antoine Dujardin
1015bad451 Don't reset cooloff time in case of login attempt during lockout 2022-04-08 22:17:05 +03:00
Gregory DAVID
1849552f45 Implement AccessFailureLog recordings 2022-04-08 22:16:19 +03:00
Vasyl Dizhak
8c5c43f482 #750, fix lockout failure when providing AXES_USERNAME_CALLABLE 2021-10-11 20:59:06 +03:00
Yuta Okamoto
17c5d3f314 set None to failures_since_start 2021-08-31 21:24:26 +03:00
Yuta Okamoto
945754eb15 make failures_since_start accessible to the views 2021-08-31 21:24:26 +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
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
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
Aleksi Häkli
e4929d2c11
Add missing get_failures handler proxy implementation
This missing implementation prevented custom implementations
for the failure fetching logic in the handler classes
because Axes would not invoke them from them,
and would use the base handler class implementation instead.
2020-01-08 22:00:36 +02:00
Hasan Ramezani
4253fddd7e Prevent multiple call on helper functions in AxesProxyHandler.update_request. (#512) (#513) 2019-11-04 10:45:24 +00:00
Aleksi Häkli
93bb73552e
Upgrade CI tooling to use automatic code formatting 2019-09-28 19:28:17 +03:00
Aleksi Häkli
d8c6632384
Make reset for attempts and logs pluggable
Fixes #454
2019-07-11 15:31:14 +02:00
Aleksi Häkli
3152b4d7e9 Improve lockout and request handling
The old architecture used exceptions in the signal handler
which prevented transactions from running smoothly
and signal handlers from running after Axes handlers.

The new architecture changes the request approach to request flagging
and moves the exception handling into the middleware call method.

This allows users to more flexibly run their own signal handlers
and optionally use the Axes middleware if they want to do so.

Fixes #440
Fixes #442
2019-05-19 18:32:40 +03:00
Aleksi Häkli
816676f68d Add settings flag for disabling Axes
AXES_ENABLED = False can be used to toggle
the plugin off in tests which use the built-in
Django test client login, force_login and logout
methods which do not supply a request views.

Fixes #433
2019-05-07 23:37:48 +03:00
Aleksi Häkli
430946a9d1 Rename AxesBaseHandler to AxesHandler 2019-04-27 18:51:02 +03:00
Aleksi Häkli
3bece1aaaa
Set Axes request attributes in middleware
Fixes #415

Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-03-03 22:13:13 +02:00
Aleksi Häkli
46fc538193
Add cache handler and refactor tests
Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-02-23 20:19:37 +02:00
Aleksi Häkli
ccace29270
Clean up handler naming and documentation
Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-02-22 20:13:20 +02: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