add get_client_ip util function

This commit is contained in:
klmp200 committed 2024-07-22 09:49:08 +02:00
1 parent 03d15ddded
commit 58ff5b934a
2 files changed
+17 -1

No files matched your search

+3 -1
View File
@@ -4,12 +4,14 @@ from typing import Any
from django.http import HttpRequest, HttpResponse
from core.utils import get_client_ip
def custom_honeypot_error(
request: HttpRequest, context: dict[str, Any]
) -> HttpResponse:
logging.warning(
f"[{strftime('%c', localtime())}] "
f"HoneyPot blocked user with ip {request.META.get('X-Forwarded-For')}"
f"HoneyPot blocked user with ip {get_client_ip(request)}"
)
return HttpResponse("Upon reading this, the http client was enlightened.")