pdupavillon / express-recaptcha

Implementation of google recaptcha v2 & V3 solutions for express.js
MIT License
128 stars 21 forks source link

Optional custom host #58

Closed grega closed 2 years ago

grega commented 2 years ago

In some instances the default reCaptcha host www.google.com may be blocked. As detailed in the reCaptcha FAQ, the recommendation is to use the alternate host www.recaptcha.net in these situations.

This PR provides the ability to do so, via an optional CUSTOM_HOST parameter.

pdupavillon commented 2 years ago

@grega - thanks for that PR! Do you see a case where the custom host could be anything different from recaptcha.net? Based on the reCaptcha FAQ they only suggest that single option.

The reason I'm asking is whether to allow the user to pass anything they want, versus using a flag that will switch internally to the recaptcha domain.

grega commented 2 years ago

@pdupavillon No, I don't 😄 I wrote this thinking that there might be, but realising that there probably wouldn't be.

Let me refactor into something that just provides a host switch instead 👍

grega commented 2 years ago

(or would you prefer the flag to be part of RecaptchaOptionsVx?)

pdupavillon commented 2 years ago

(or would you prefer the flag to be part of RecaptchaOptionsVx?)

yes please, with something like: useRecaptchaDomain thanks

grega commented 2 years ago

All sorted I believe.

pdupavillon commented 2 years ago

Thanks; I need to make some change on the ci-cd side. I'll ping you once the new version is released.

pdupavillon commented 2 years ago

FYI - version 5.1.0 has been released with that change.

grega commented 2 years ago

Thanks!