forked from MirrorHub/synapse
SYN-395: Fix CAPTCHA, don't double decode json
This commit is contained in:
parent
79e37a7ecb
commit
afbd3b2fc4
1 changed files with 3 additions and 2 deletions
|
@ -187,7 +187,7 @@ class AuthHandler(BaseHandler):
|
||||||
# each request
|
# each request
|
||||||
try:
|
try:
|
||||||
client = SimpleHttpClient(self.hs)
|
client = SimpleHttpClient(self.hs)
|
||||||
data = yield client.post_urlencoded_get_json(
|
resp_body = yield client.post_urlencoded_get_json(
|
||||||
"https://www.google.com/recaptcha/api/siteverify",
|
"https://www.google.com/recaptcha/api/siteverify",
|
||||||
args={
|
args={
|
||||||
'secret': self.hs.config.recaptcha_private_key,
|
'secret': self.hs.config.recaptcha_private_key,
|
||||||
|
@ -198,7 +198,8 @@ class AuthHandler(BaseHandler):
|
||||||
except PartialDownloadError as pde:
|
except PartialDownloadError as pde:
|
||||||
# Twisted is silly
|
# Twisted is silly
|
||||||
data = pde.response
|
data = pde.response
|
||||||
resp_body = simplejson.loads(data)
|
resp_body = simplejson.loads(data)
|
||||||
|
|
||||||
if 'success' in resp_body and resp_body['success']:
|
if 'success' in resp_body and resp_body['success']:
|
||||||
defer.returnValue(True)
|
defer.returnValue(True)
|
||||||
raise LoginError(401, "", errcode=Codes.UNAUTHORIZED)
|
raise LoginError(401, "", errcode=Codes.UNAUTHORIZED)
|
||||||
|
|
Loading…
Reference in a new issue