Skip to content

Commit

Permalink
[Fixes #11147] Strip port from visitor_ip_address (#11148)
Browse files Browse the repository at this point in the history
* strip port from visitor_ip_address

* gix PEP
  • Loading branch information
giohappy authored Jun 5, 2023
1 parent f90bc73 commit 6887596
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions geonode/base/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ def visitor_ip_address(request):
ip = x_forwarded_for.split(",")[0]
else:
ip = request.META.get("REMOTE_ADDR")
if ip:
ip = re.match(r"(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})", ip)[0]
return ip


Expand Down

0 comments on commit 6887596

Please sign in to comment.