diff options
author | Kegan Dougal <kegan@matrix.org> | 2014-09-05 22:51:11 -0700 |
---|---|---|
committer | Kegan Dougal <kegan@matrix.org> | 2014-09-05 22:51:11 -0700 |
commit | 37e53513b6789b4f9f845a26b64933f1c533ed62 (patch) | |
tree | 9ed0634ce25b52e46ca7a5b7135c1fee2f769fc8 /synapse/rest | |
parent | Captchas now work on registration. Missing x-forwarded-for config arg support... (diff) | |
download | synapse-37e53513b6789b4f9f845a26b64933f1c533ed62.tar.xz |
Add config opion for XFF headers when performing ReCaptcha auth.
Diffstat (limited to '')
-rw-r--r-- | synapse/rest/register.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/synapse/rest/register.py b/synapse/rest/register.py index 3c8929cf9b..5872a11d80 100644 --- a/synapse/rest/register.py +++ b/synapse/rest/register.py @@ -66,8 +66,11 @@ class RegisterRestServlet(RestServlet): # TODO determine the source IP : May be an X-Forwarding-For header depending on config ip_addr = request.getClientIP() - #if self.hs.config.captcha_ip_origin_is_x_forwarded: - # # use the header + if self.hs.config.captcha_ip_origin_is_x_forwarded: + # use the header + if request.requestHeaders.hasHeader("X-Forwarded-For"): + ip_addr = request.requestHeaders.getRawHeaders( + "X-Forwarded-For")[0] captcha = { "ip": ip_addr, |