Commit graph

59 commits

Author SHA1 Message Date
Aleksi Häkli
4b77eb69ee Run black autoformatting 2026-02-11 22:14:31 +02:00
Aleksi Häkli
4ea615811b Implement custom lazy object to avoid JSON errors with Celery
Fixes jazzband/django-axes#1391
2026-02-11 22:14:31 +02:00
rodrigo.nogueira
6703b66f17 Fix circular import with custom user models
Fixes #1280

- Use SimpleLazyObject to defer get_user_model() evaluation
- Prevents circular import when custom user models import from axes
- Add test coverage for lazy evaluation in test_conf.py
2026-02-06 20:19:42 +02:00
kuldeepkhatke
a1e9eff875 Renamed AXES_INDIVIDUAL_ATTEMPT_EXPIRY flag to AXES_USE_ATTEMPT_EXPIRATION 2025-07-05 16:19:19 +03:00
kuldeepkhatke
0fd9ccd1d4 Added individual attempt expiry feature 2025-07-05 16:19:19 +03:00
Andrew Neher
129e93cc0e savepoint 2025-02-19 18:09:40 +02:00
Ronny Vedrilla
e9db2d9631 #1093: "AXES_SENSITIVE_PARAMETERS" now have sensible defaults to follow "privacy-by-design" 2023-07-30 18:59:48 +03:00
Maksim Zayakin
73c4e4501b chore: adjust types: use list instead of iterables and nested lists instead of tuples 2023-05-13 14:04:14 +03:00
Maksim Zayakin
ffc161e814 feat!: add AXES_LOCKOUT_PARAMETERS flag
BREAKING CHANGE: add `AXES_LOCKOUT_PARAMETERS` flag which accepts an iterable of keys or a callable that resolves an iterable.
The key can be a string (represents a single parameter) or an Iterable of strings (represents a combined parameter).
For example, using this parameters
```python
AXES_LOCKOUT_PARAMETERS = [
    "ip_address",
    ("username", "user_agent"),
]
```
axes will block users by IP and/or combination of username and user agent
2023-05-13 14:04:14 +03:00
Aleksi Häkli
31249a5947 Update django-ipware configuration flags to new AXES_IPWARE_ prefixes
Use explicit new AXES_IPWARE_ referencing configuration flag names
in place of the old plain implicit AXES_ name prefixes
2023-04-28 14:16:44 +03:00
Maksim Zayakin
8294fdf756 feat!: set default response code to 429 2023-04-25 19:42:37 +03:00
Maksim Zayakin
7ae0af2a1e add AXES_CLIENT_IP_CALLABLE setting 2023-03-29 16:35:06 +03:00
Aleksi Häkli
621dfa6882 Fix code formatting 2022-05-16 10:41:07 +03:00
Antoine Dujardin
9c2ceb7eb7 Add option to keep current behavior for cooloff reset 2022-04-08 22:17:05 +03:00
Gregory DAVID
1849552f45 Implement AccessFailureLog recordings 2022-04-08 22:16:19 +03:00
phil-bell
91bdb3be99 adding missing extra ending line 2021-08-19 16:02:32 +03:00
phil-bell
6858aea99a Adding ability to change http response code 2021-08-19 16:02:32 +03:00
smtydn
1a8d96e242 Add AXES_CLIENT_STR_CALLABLE setting 2021-05-19 20:54:57 +03:00
Michael O'Connor
170dacc112 Integrate AXS_SENSITIVE_PARAMETERS functionality with AXES_PASSWORD_FORM_FIELD 2021-05-03 17:10:45 +03:00
Michael O'Connor
f54c4f095b Add option to cleanse sensitive GET and POST params in database handler 2021-05-03 17:10:45 +03:00
Ashok Argent-Katwala
bdffe67bd8 Add trailing period for consistency.
The other lock-out message has whole sentences, and two of the three translations do.
2021-02-24 19:02:40 +02:00
Christian Bundy
2241dbe011 Set AXES_VERBOSE default to AXES_ENABLED
Problem: When `AXES_ENABLED == False` we still see log output because `AXES_VERBOSE == True`.

Solution: Change `AXES_VERBOSE` default so that if django-axes is disabled then we don't output to stdout.
2021-02-20 15:30:59 +02:00
Vladimir Knobel
3d1e77298d Update conf.py
adds new AXES_ALLOWED_CORS_ORIGINS setting
2021-01-05 15:18:59 +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
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
8b619dfdef Deprecate django-appconf 2020-09-12 17:03:50 +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
3ceb546ae2
Fix/585 (#586)
* Fixes #585 where appconf sniffs the module name for a settings prefix

Co-authored-by: Mark Walker <mark.walker@realbuzz.com>
2020-05-15 19:24:08 +03:00
Aleksi Häkli
d3da797020 Add configurable lockout callable
Fixes #511
2020-01-08 21:28:14 +02:00
Aleksi Häkli
34d3b5a1f5
Pluggable user account whitelisting (#549)
Fixes #536
2019-12-29 23:43:55 +02:00
Sachin Kukreja
d3b377f550 Added support for DRF json payload in request 2019-10-25 11:02:00 +03:00
Sakari Kapanen
0a97603cce Add AXES_ENABLE_ADMIN flag to configure showing Axes in admin (#499) 2019-10-09 19:02:45 +03:00
Aleksi Häkli
93bb73552e
Upgrade CI tooling to use automatic code formatting 2019-09-28 19:28:17 +03:00
Hasan Ramezani
6f2048f7ca Added AXES_ONLY_ADMIN_SITE flag. 2019-07-09 08:12:33 +02:00
Aleksi Häkli
47ae68b0c0 Deprecate AXES_DISABLE_SUCCESS_ACCESS_LOG flag
Fixes #446
2019-05-25 20:45:21 +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
180f2b85d6
Use django-appconf to 1.0.3+
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>
2019-03-09 21:49:45 +02: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
677d4c48f4
Improve documentation
- Add information on handlers
- Document configuration options and precedences
- Restructure documentation for better readability

Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-02-25 17:04:03 +02:00
Aleksi Häkli
d4c2603ed7
Add six imports for Django master compatibility
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>
2019-02-24 15:46:30 +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
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
f8949ce984
Add configurable client IP attribute on requests
Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-02-22 19:55:47 +02:00
Aleksi Häkli
9b0f664dcd
Remove redundant comment
Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-02-22 19:55:34 +02:00
Aleksi Häkli
cd56631865
Refactor attempts and add NEVER_LOCKOUT_GET flag
- 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>
2019-02-13 18:20:04 +02:00
Aleksi Häkli
df83adb059
Run more comprehensive prospector checks
Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
2019-02-12 23:33:18 +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
Arjen
ac4ab22183
Added setting to reset failed attempts on successful login. 2018-10-26 14:45:06 +02:00
Andreas Donig
c6bf55c04d Change _ to be gettext_lazy 2018-07-17 15:14:17 +02:00