Skip to content

Commit

Permalink
Merge pull request #174 from USEPA/fix_host_bug
Browse files Browse the repository at this point in the history
dont use host header directly use get_host since referer is used.
  • Loading branch information
tbock authored Sep 24, 2024
2 parents aacd4c5 + 7080523 commit 68f4bc0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions accounts/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ def has_add_permission(self, request):
def has_delete_permission(self, request, obj=None):
return False

# this may no longer be needed due to using autcomplete fields
def get_search_results(self, request, queryset, search_term):
referrer = request.META.get('HTTP_REFERER', '')
if 'responseproject' in referrer:
Expand Down
2 changes: 1 addition & 1 deletion accounts/func.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def enable_account(account_request, password):

def get_object_id_from_request(request):
referrer = request.META.get('HTTP_REFERER')
host = request.META.get('HTTP_HOST')
host = request.get_host()
path = referrer.split(host)[1].split('?')[0]
r = resolve(path)
return r.kwargs.get('object_id', None)
Expand Down

0 comments on commit 68f4bc0

Please sign in to comment.