fix: Fix filter attribute in rate limiting logic
Corrects the attribute name used in IPBlock filtering from 'expiry' to 'expires'. This ensures that the rate limit check properly references the intended field to evaluate expiration against the current time.
This commit is contained in:
parent
e15224ca69
commit
cae8d07431
1 changed files with 1 additions and 1 deletions
|
@ -23,7 +23,7 @@ class RateLimitMixin:
|
|||
else:
|
||||
ip_address = request.META.get("HTTP_X_FORWARDED_FOR")
|
||||
|
||||
for block in IPBlock.objects.filter(expiry__gt=timezone.now()):
|
||||
for block in IPBlock.objects.filter(expires__gt=timezone.now()):
|
||||
if ip_network(ip_address) in ip_network(f"{block.network}/{block.netmask}"):
|
||||
return render(request, "registration/ratelimit.html", status=429)
|
||||
|
||||
|
|
Loading…
Reference in a new issue