generated from okp4/template-go
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
captchaToken is now optionnal in GraphQL send request captcha verify url is now configurable captcha min score is now configurable add errors to log context when logging errors using context when requesting captcha verification
- Loading branch information
Showing
11 changed files
with
67 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
package captcha | ||
|
||
import "github.com/rs/zerolog/log" | ||
import ( | ||
"context" | ||
|
||
type Resolver interface { | ||
CheckRecaptcha(string) error | ||
} | ||
"github.com/rs/zerolog/log" | ||
) | ||
|
||
type resolver struct { | ||
secret string | ||
type Resolver interface { | ||
CheckRecaptcha(context.Context, string) error | ||
} | ||
|
||
func NewCaptchaResolver(secret string) Resolver { | ||
func NewCaptchaResolver(secret, verifyURL string, minScore float64) Resolver { | ||
if secret == "" { | ||
log.Fatal().Msg("Required Captcha secret not set") | ||
log.Error().Msg("Required Captcha secret not set") | ||
} | ||
return resolver{ | ||
secret: secret, | ||
secret: secret, | ||
siteVerifyURL: verifyURL, | ||
minScore: minScore, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters