mirror of
https://github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin.git
synced 2025-11-08 15:15:05 +01:00
🐛 fix bug with recaptcha (#141) and add doc for recaptcha
* 🐛 fix bug with recaptcha * 📝 Add documentation for recpatcha --------- Co-authored-by: max.lerebourg <max.lerebourg@monisnap.com> Co-authored-by: mhx <mathieu@hanotaux.fr>
This commit is contained in:
@@ -335,4 +335,4 @@
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
@@ -143,4 +143,19 @@ sequenceDiagram
|
||||
Destroy PluginCache
|
||||
PluginCache-->>TraefikPlugin: Yes a ban Decision
|
||||
TraefikPlugin->>User: No, HTTP 403
|
||||
```
|
||||
```
|
||||
|
||||
## Captcha Configuration:
|
||||
|
||||
- Recaptcha
|
||||
|
||||
Choose v2 (challenge) and configure the domain to protect:
|
||||

|
||||
|
||||
- Turnstile
|
||||
|
||||
TODO
|
||||
|
||||
- Hcatpcha
|
||||
|
||||
TODO
|
||||
@@ -335,4 +335,4 @@
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
||||
BIN
examples/captcha/image_recaptcha.png
Normal file
BIN
examples/captcha/image_recaptcha.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 77 KiB |
@@ -8,6 +8,7 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
cache "github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin/pkg/cache"
|
||||
configuration "github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin/pkg/configuration"
|
||||
@@ -152,7 +153,8 @@ func (c *Client) Validate(r *http.Request) (bool, error) {
|
||||
c.log.Error(fmt.Sprintf("captcha:Validate %s", err.Error()))
|
||||
}
|
||||
}()
|
||||
if res.Header.Get("content-type") != "application/json" {
|
||||
if !strings.Contains(res.Header.Get("content-type"), "application/json") {
|
||||
c.log.Debug("captcha:Validate responseType:noJson")
|
||||
return false, nil
|
||||
}
|
||||
var captchaResponse responseProvider
|
||||
|
||||
Reference in New Issue
Block a user