mirror of
https://github.com/postgres/pgweb.git
synced 2025-08-06 09:57:57 +00:00
Use new get_client_ip() function instead of using REMOTE_ADDR.
This commit is contained in:
@ -13,6 +13,7 @@ import cPickle as pickle
|
||||
from pgweb.util.decorators import ssl_required, nocache
|
||||
from pgweb.util.contexts import NavContext
|
||||
from pgweb.util.helpers import simple_form, PgXmlHelper
|
||||
from pgweb.util.misc import get_client_ip
|
||||
|
||||
from models import *
|
||||
from forms import *
|
||||
@ -90,7 +91,7 @@ def ftpbrowser(request, subpath):
|
||||
|
||||
def _get_numeric_ip(request):
|
||||
try:
|
||||
ip = request.META['REMOTE_ADDR']
|
||||
ip = get_client_ip(request)
|
||||
p = ip.split('.')
|
||||
return int(p[0])*16777216 + int(p[1])*65536 + int(p[2])*256 + int(p[3])
|
||||
except:
|
||||
|
@ -3,6 +3,7 @@ from django.http import HttpResponse, Http404, HttpResponseServerError, HttpResp
|
||||
from django.db import connection
|
||||
|
||||
from pgweb.util.contexts import NavContext
|
||||
from pgweb.util.misc import get_client_ip
|
||||
|
||||
from models import Survey, SurveyAnswer, SurveyLock
|
||||
|
||||
@ -26,12 +27,7 @@ def vote(request, surveyid):
|
||||
attrname = "tot%s" % ansnum
|
||||
|
||||
# Do IP based locking...
|
||||
try:
|
||||
addr = request.META.get('REMOTE_ADDR')
|
||||
if addr == None or addr == "":
|
||||
raise Exception()
|
||||
except:
|
||||
return HttpResponseServerError("Unable to determine client IP address")
|
||||
addr = get_client_ip(request)
|
||||
|
||||
# Clean out any old junk
|
||||
curs = connection.cursor()
|
||||
|
Reference in New Issue
Block a user