mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
Merge pull request #170 from matrix-org/markjh/SYT-8-recaptcha
Allow endpoint for verifying recaptcha to be configured
This commit is contained in:
commit
d70c847b4f
@ -26,6 +26,7 @@ class CaptchaConfig(Config):
|
|||||||
config["captcha_ip_origin_is_x_forwarded"]
|
config["captcha_ip_origin_is_x_forwarded"]
|
||||||
)
|
)
|
||||||
self.captcha_bypass_secret = config.get("captcha_bypass_secret")
|
self.captcha_bypass_secret = config.get("captcha_bypass_secret")
|
||||||
|
self.recaptcha_siteverify_api = config["recaptcha_siteverify_api"]
|
||||||
|
|
||||||
def default_config(self, config_dir_path, server_name):
|
def default_config(self, config_dir_path, server_name):
|
||||||
return """\
|
return """\
|
||||||
@ -48,4 +49,7 @@ class CaptchaConfig(Config):
|
|||||||
|
|
||||||
# A secret key used to bypass the captcha test entirely.
|
# A secret key used to bypass the captcha test entirely.
|
||||||
#captcha_bypass_secret: "YOUR_SECRET_HERE"
|
#captcha_bypass_secret: "YOUR_SECRET_HERE"
|
||||||
|
|
||||||
|
# The API endpoint to use for verifying m.login.recaptcha responses.
|
||||||
|
recaptcha_siteverify_api: "https://www.google.com/recaptcha/api/siteverify"
|
||||||
"""
|
"""
|
||||||
|
@ -188,7 +188,7 @@ class AuthHandler(BaseHandler):
|
|||||||
try:
|
try:
|
||||||
client = SimpleHttpClient(self.hs)
|
client = SimpleHttpClient(self.hs)
|
||||||
resp_body = yield client.post_urlencoded_get_json(
|
resp_body = yield client.post_urlencoded_get_json(
|
||||||
"https://www.google.com/recaptcha/api/siteverify",
|
self.hs.config.recaptcha_siteverify_api,
|
||||||
args={
|
args={
|
||||||
'secret': self.hs.config.recaptcha_private_key,
|
'secret': self.hs.config.recaptcha_private_key,
|
||||||
'response': user_response,
|
'response': user_response,
|
||||||
|
Loading…
Reference in New Issue
Block a user