From 6432e34151423df455f4206bd83cf2b3d1d9120a Mon Sep 17 00:00:00 2001 From: "Gerasimos (Makis) Maropoulos" Date: Sat, 11 Apr 2020 20:23:02 +0300 Subject: [PATCH] typo fix on recaptcha middleware... Former-commit-id: 214c56fcd84c86742175e37185e130eeae85f07f --- _examples/miscellaneous/recaptcha/main.go | 2 +- middleware/recaptcha/recaptcha.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/_examples/miscellaneous/recaptcha/main.go b/_examples/miscellaneous/recaptcha/main.go index f908b78f..0648bede 100644 --- a/_examples/miscellaneous/recaptcha/main.go +++ b/_examples/miscellaneous/recaptcha/main.go @@ -26,7 +26,7 @@ func main() { return } - result := recaptcha.SiteFerify(ctx, recaptchaSecret) + result := recaptcha.SiteVerify(ctx, recaptchaSecret) if !result.Success { /* redirect here if u want or do nothing */ ctx.HTML(" failed please try again ") diff --git a/middleware/recaptcha/recaptcha.go b/middleware/recaptcha/recaptcha.go index ec416883..cd54a66b 100644 --- a/middleware/recaptcha/recaptcha.go +++ b/middleware/recaptcha/recaptcha.go @@ -39,18 +39,18 @@ var Client = netutil.Client(time.Duration(20 * time.Second)) // Use `SiteVerify` to verify a request inside another handler if needed. func New(secret string) context.Handler { return func(ctx context.Context) { - if SiteFerify(ctx, secret).Success { + if SiteVerify(ctx, secret).Success { ctx.Next() } } } -// SiteFerify accepts context and the secret key(https://www.google.com/recaptcha) +// SiteVerify accepts context and the secret key(https://www.google.com/recaptcha) // and returns the google's recaptcha response, if `response.Success` is true // then validation passed. // // Use `New` for middleware use instead. -func SiteFerify(ctx context.Context, secret string) (response Response) { +func SiteVerify(ctx context.Context, secret string) (response Response) { generatedResponseID := ctx.FormValue("g-recaptcha-response") if generatedResponseID == "" { response.ErrorCodes = append(response.ErrorCodes, @@ -111,7 +111,7 @@ var recaptchaForm = `
// Method: "POST" | Path: "/contact" // func postContact(ctx context.Context) { // // [...] -// response := recaptcha.SiteFerify(ctx, recaptchaSecret) +// response := recaptcha.SiteVerify(ctx, recaptchaSecret) // // if response.Success { // // [your action here, i.e sendEmail(...)]