pentacent / keila

Open Source Newsletter Tool.
https://keila.io
GNU Affero General Public License v3.0
1.38k stars 70 forks source link

Add support for FriendlyCaptcha #209

Closed beeb closed 1 year ago

beeb commented 1 year ago

FriendlyCaptcha is a nice and privacy-preserving alternative to hCaptcha that doesn't require tedious actions by the user.

This PR adds support for FriendlyCaptcha as an alternative to hCaptcha. The choice is done with a new variable CAPTCHA_PROVIDER with values hcatpcha (default) and friendly_captcha being acceptable.

All references to hCaptcha have been renamed to Captcha where relevant. Notably, the following environment variables should be used for configuration:

For backwards compatiblity, the current variables (HCAPTCHA_SITE_KEY, etc) are checked in case the above variants are not provided.

Documentation should probably be updated to reflect this. The default value for the API url when using FriendlyCaptcha is https://api.friendlycaptcha.com/api/v1/siteverify.

This PR closes https://github.com/pentacent/keila/issues/205

beeb commented 1 year ago

First time I write elixir, it's probably not great, comments are welcome!

beeb commented 1 year ago

Thanks for the very insightful comments! I went through and fixed the code accordingly.

beeb commented 1 year ago

@wmnnd let me know if anything else is needed for this to be merged. Thanks

satoshinotdead commented 1 year ago

How can I try this patch if I'm using docker version of Keila?

Sorry because my 'noobish' question but that will be my first time doing that way (privacy always matters for us) :)

wmnnd commented 1 year ago

Hey @beeb, thanks again for contributing this PR and for implementing the changes I proposed in my review. I have changed some things around a little bit to keep all captcha-related logic in the captcha module. Other than that, great job!

If you want, it would be great if you could also update the website docs at https://github.com/pentacent/keila-web to make sure the new way of configuring captchas is visible to everyone :smiley:

beeb commented 1 year ago

Done! https://github.com/pentacent/keila-web/pull/8 😄