Skip to content

Commit

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

* gix PEP

(cherry picked from commit 6887596)

Co-authored-by: Giovanni Allegri <[email protected]>
  • Loading branch information
github-actions[bot] and giohappy authored Jun 5, 2023
1 parent b045b0f commit 81cdb01
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 81cdb01

Please sign in to comment.