From bd6ae32c078e441414e00266a89eebd58f15ae2e Mon Sep 17 00:00:00 2001 From: Koichi MATSUMOTO Date: Tue, 19 Nov 2019 11:42:34 -0800 Subject: [PATCH 1/4] modify recatpcha api address. --- modules/recaptcha/recaptcha.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/recaptcha/recaptcha.go b/modules/recaptcha/recaptcha.go index 2d7bb6a5a6bb3..387c491273a29 100644 --- a/modules/recaptcha/recaptcha.go +++ b/modules/recaptcha/recaptcha.go @@ -24,10 +24,11 @@ type Response struct { ErrorCodes []string `json:"error-codes"` } -const apiURL = "/api/siteverify" +const apiURL = "/recaptcha/api/siteverify" // Verify calls Google Recaptcha API to verify token func Verify(response string) (bool, error) { + println(util.URLJoin(setting.Service.RecaptchaURL, apiURL)) resp, err := http.PostForm(util.URLJoin(setting.Service.RecaptchaURL, apiURL), url.Values{"secret": {setting.Service.RecaptchaSecret}, "response": {response}}) if err != nil { From c67c4fbc08fc7418127f7f6995f2adeee6faf61b Mon Sep 17 00:00:00 2001 From: Koichi MATSUMOTO Date: Tue, 19 Nov 2019 11:45:04 -0800 Subject: [PATCH 2/4] del debug print --- modules/recaptcha/recaptcha.go | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/recaptcha/recaptcha.go b/modules/recaptcha/recaptcha.go index 387c491273a29..4959ad26fab74 100644 --- a/modules/recaptcha/recaptcha.go +++ b/modules/recaptcha/recaptcha.go @@ -28,7 +28,6 @@ const apiURL = "/recaptcha/api/siteverify" // Verify calls Google Recaptcha API to verify token func Verify(response string) (bool, error) { - println(util.URLJoin(setting.Service.RecaptchaURL, apiURL)) resp, err := http.PostForm(util.URLJoin(setting.Service.RecaptchaURL, apiURL), url.Values{"secret": {setting.Service.RecaptchaSecret}, "response": {response}}) if err != nil { From a1176f270229285352e726e246d3ab5086a99b87 Mon Sep 17 00:00:00 2001 From: Koichi MATSUMOTO Date: Tue, 19 Nov 2019 12:22:40 -0800 Subject: [PATCH 3/4] change apiURL --- modules/recaptcha/recaptcha.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/recaptcha/recaptcha.go b/modules/recaptcha/recaptcha.go index 4959ad26fab74..6d4c33b90e8dc 100644 --- a/modules/recaptcha/recaptcha.go +++ b/modules/recaptcha/recaptcha.go @@ -24,10 +24,11 @@ type Response struct { ErrorCodes []string `json:"error-codes"` } -const apiURL = "/recaptcha/api/siteverify" +const apiURL = "api/siteverify" // Verify calls Google Recaptcha API to verify token func Verify(response string) (bool, error) { + fmt.Printf("RECAPTCHA_URL: %s\n", util.URLJoin(setting.Service.RecaptchaURL, apiURL)) resp, err := http.PostForm(util.URLJoin(setting.Service.RecaptchaURL, apiURL), url.Values{"secret": {setting.Service.RecaptchaSecret}, "response": {response}}) if err != nil { From b46eb1f73e21d099ec0fcd64a6661eeef461a7e4 Mon Sep 17 00:00:00 2001 From: Koichi MATSUMOTO Date: Tue, 19 Nov 2019 12:25:26 -0800 Subject: [PATCH 4/4] delete debug print --- modules/recaptcha/recaptcha.go | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/recaptcha/recaptcha.go b/modules/recaptcha/recaptcha.go index 6d4c33b90e8dc..a9718f2fdd111 100644 --- a/modules/recaptcha/recaptcha.go +++ b/modules/recaptcha/recaptcha.go @@ -28,7 +28,6 @@ const apiURL = "api/siteverify" // Verify calls Google Recaptcha API to verify token func Verify(response string) (bool, error) { - fmt.Printf("RECAPTCHA_URL: %s\n", util.URLJoin(setting.Service.RecaptchaURL, apiURL)) resp, err := http.PostForm(util.URLJoin(setting.Service.RecaptchaURL, apiURL), url.Values{"secret": {setting.Service.RecaptchaSecret}, "response": {response}}) if err != nil {