eduardoboucas / staticman

💪 User-generated content for Git-powered websites
https://staticman.net
MIT License
2.41k stars 534 forks source link

Add HCaptcha and ReCaptcha V3 and refacto ReCaptcha V2 #421

Open midiland opened 3 years ago

midiland commented 3 years ago

Hello, Here is with a PR, for Hcaptcha support of ReCaptcha V2 and ReCaptchaV3.

I used the factory paterne, to give a possibility of other Captcha service implementation

Warning: I had to modify the structure of the staticman.yml file

For HCaptcha

 # use Captcha you can use ReCaptcha or HCaptcha 
  captcha:
    enabled: true
    service: HCaptcha
    HCaptcha:
      secret: Secret 

For ReCaptchaV2

 # use Captcha you can use ReCaptcha or HCaptcha 
  captcha:
    enabled: true
    service: ReCaptcha
    ReCaptcha:
      secret: Secret
      version: V2

For ReCaptchaV3

 # use Captcha you can use ReCaptcha or HCaptcha 
  captcha:
    enabled: true
    service: ReCaptcha
    ReCaptcha:
      secret: Secret 
      version: V3
      score: 0.5

I also updated the tests.

Don't hesitate to give me feedback.

JonBoyleCoding commented 1 year ago

I was just looking at this for myself @midiland, but I believe this commit has too many conflicts as it's from a branch where you have re-organised the file/folder structure.

I'd be interested in this for myself if it could be easily merged in though ;). I don't know enough about javascript to understand without a ton of effort unfortunately.

EDIT: Oh wait, you're pulling into Dev branch - I was trying to merge into master. Stupid me ;)