Commit 46ac1b0f authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

Captcha field: temp fix for anonymous

We add SERVERID  cookie for anonymous.But captcha should used shared
ressources for its validation (shared in the sense of among nodes)
parent 66bb674d
...@@ -214,6 +214,10 @@ class CaptchaWidget(Widget.TextWidget): ...@@ -214,6 +214,10 @@ class CaptchaWidget(Widget.TextWidget):
size=10) size=10)
# HTML page having a captcha field should never be cached. # HTML page having a captcha field should never be cached.
REQUEST.RESPONSE.setHeader('Cache-Control', 'max-age=0') REQUEST.RESPONSE.setHeader('Cache-Control', 'max-age=0')
if not REQUEST.cookies.get(REQUEST.getHeader('HTTP_X_BALANCER_CURRENT_COOKIE')):
REQUEST.RESPONSE.setCookie(REQUEST.getHeader('HTTP_X_BALANCER_CURRENT_COOKIE'),
REQUEST.getHeader('HTTP_X_BALANCER_CURRENT_SERVER'),
path='/')
return captcha_field + key_field + splitter + answer return captcha_field + key_field + splitter + answer
def render_view(self, field, value, REQUEST=None, render_prefix=None): def render_view(self, field, value, REQUEST=None, render_prefix=None):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment