fix anti-spam
This commit is contained in:
parent
03ee9a1e0b
commit
5d6574fb37
2 changed files with 5 additions and 6 deletions
|
|
@ -18,9 +18,9 @@ def new_form_comment():
|
|||
data = request.form
|
||||
|
||||
# add client IP if provided by HTTP proxy
|
||||
logger.info('headers: {}'.format(request.headers))
|
||||
clientip = ''
|
||||
if 'X-Forwarded-For' in request.headers:
|
||||
data['clientip'] = request.headers['X-Forwarded-For']
|
||||
clientip = request.headers['X-Forwarded-For']
|
||||
|
||||
# log
|
||||
logger.info(data)
|
||||
|
|
@ -38,7 +38,7 @@ def new_form_comment():
|
|||
logger.warn('discard spam: data %s' % data)
|
||||
abort(400)
|
||||
|
||||
processor.enqueue({'request': 'new_comment', 'data': data})
|
||||
processor.enqueue({'request': 'new_comment', 'data': data, 'clientip': clientip})
|
||||
|
||||
except:
|
||||
logger.exception("new comment failure")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue