Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Add configurable captcha score and set widget actions

Roland Geiderce11ab08cc4c
diff --git a/settings/main.py b/settings/main.py
index 5147ec283..d258abf5a 100644
--- a/settings/main.py
+++ b/settings/main.py
@@ -70,6 +70,7 @@ SECRET_KEY = env.str('SECRET_KEY', 'wger-docker-supersecret-key-1234567890!@#$%^
# Your reCaptcha keys
RECAPTCHA_PUBLIC_KEY = env.str('RECAPTCHA_PUBLIC_KEY', '')
RECAPTCHA_PRIVATE_KEY = env.str('RECAPTCHA_PRIVATE_KEY', '')
+RECAPTCHA_REQUIRED_SCORE = env.float('RECAPTCHA_REQUIRED_SCORE', 0.75)
# The site's URL (e.g. http://www.my-local-gym.com or http://localhost:8000)
# This is needed for uploaded files and images (exercise images, etc.) to be
diff --git a/settings/settings_global.py b/settings/settings_global.py
index 83591dce1..14817caf4 100644
--- a/settings/settings_global.py
+++ b/settings/settings_global.py
@@ -308,10 +308,6 @@ LOGGING = {
},
}
-#
-# ReCaptcha
-#
-RECAPTCHA_USE_SSL = True
#
# Cache
@@ -546,7 +542,9 @@ ACTSTREAM_SETTINGS = {
# Whether the application is being run regularly or during tests
TESTING = len(sys.argv) > 1 and sys.argv[1] == 'test'
-# Your reCaptcha keys
+#
+# django-recaptcha
+#
RECAPTCHA_PUBLIC_KEY = ''
RECAPTCHA_PRIVATE_KEY = ''
-NOCAPTCHA = True
+RECAPTCHA_REQUIRED_SCORE = 0
diff --git a/wger/core/forms.py b/wger/core/forms.py
index 8c1dc1422..a3116f38d 100644
--- a/wger/core/forms.py
+++ b/wger/core/forms.py
@@ -286,7 +286,7 @@ class RegistrationForm(UserCreationForm, UserEmailForm):
"""
captcha = ReCaptchaField(
- widget=ReCaptchaV3,
+ widget=ReCaptchaV3(action='register'),
label='reCaptcha',
help_text=gettext_lazy('The form is secured with reCAPTCHA'),
)
@@ -344,7 +344,7 @@ class RegistrationFormNoCaptcha(UserCreationForm, UserEmailForm):
class PasswordResetFormCaptcha(PasswordResetForm):
captcha = ReCaptchaField(
- widget=ReCaptchaV3,
+ widget=ReCaptchaV3(action='password_reset'),
label='reCaptcha',
help_text=gettext_lazy('The form is secured with reCAPTCHA'),
)