Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #946 from matrix-org/dbkr/log_recaptcha_hostname
Browse files Browse the repository at this point in the history
Log the hostname the reCAPTCHA was completed on
  • Loading branch information
dbkr authored Jul 25, 2016
2 parents 955ef1f + 7ed58bb commit 4fcdf7b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions synapse/handlers/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,17 @@ def _check_recaptcha(self, authdict, clientip):
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
Expand Down

0 comments on commit 4fcdf7b

Please sign in to comment.