summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Baker <dbkr@users.noreply.github.com>2016-07-25 16:10:39 +0100
committerGitHub <noreply@github.com>2016-07-25 16:10:39 +0100
commit4fcdf7b4b2fc447f884395b95c1c9f13795979c6 (patch)
treef294afcc22e18a6e569170b5ab242b4e01523577
parentfix: defer.returnValue takes one argument (diff)
parentUse get to avoid KeyErrors (diff)
downloadsynapse-4fcdf7b4b2fc447f884395b95c1c9f13795979c6.tar.xz
Merge pull request #946 from matrix-org/dbkr/log_recaptcha_hostname
Log the hostname the reCAPTCHA was completed on
-rw-r--r--synapse/handlers/auth.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/synapse/handlers/auth.py b/synapse/handlers/auth.py

index 8f83923ddb..d5d2072436 100644 --- a/synapse/handlers/auth.py +++ b/synapse/handlers/auth.py
@@ -279,8 +279,17 @@ class AuthHandler(BaseHandler): data = pde.response resp_body = simplejson.loads(data) - if 'success' in resp_body and resp_body['success']: - defer.returnValue(True) + if 'success' in resp_body: + # Note that we do NOT check the hostname here: we explicitly + # intend the CAPTCHA to be presented by whatever client the + # user is using, we just care that they have completed a CAPTCHA. + logger.info( + "%s reCAPTCHA from hostname %s", + "Successful" if resp_body['success'] else "Failed", + resp_body.get('hostname') + ) + if resp_body['success']: + defer.returnValue(True) raise LoginError(401, "", errcode=Codes.UNAUTHORIZED) @defer.inlineCallbacks