Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Issue #117 - Make captcha usage configurable

matheus5ae572ebef65
diff --git a/wger/core/views/user.py b/wger/core/views/user.py
index 389e7ab5b..60b9abef7 100644
--- a/wger/core/views/user.py
+++ b/wger/core/views/user.py
@@ -50,7 +50,7 @@ from wger.manager.models import Workout
from wger.nutrition.models import NutritionPlan
from wger.config.models import GymConfig
from wger.weight.models import WeightEntry
-
+from wger.settings_global import *
logger = logging.getLogger('wger.custom')
@@ -189,6 +189,10 @@ def registration(request):
is_app = check_request_amazon(request) or check_request_android(request)
FormClass = RegistrationFormNoCaptcha if is_app else RegistrationForm
+ # Don't show captcha if the global parameter is false
+ if WGER_SETTINGS['USE_RECAPTCHA'] == False:
+ FormClass = RegistrationFormNoCaptcha
+
# Redirect regular users, in case they reached the registration page
if request.user.is_authenticated() and not request.user.userprofile.is_temporary:
return HttpResponseRedirect(reverse('core:dashboard'))
diff --git a/wger/settings_global.py b/wger/settings_global.py
index a7207ab23..cc2dec94d 100644
--- a/wger/settings_global.py
+++ b/wger/settings_global.py
@@ -328,3 +328,7 @@ REST_FRAMEWORK = {
#
CORS_ORIGIN_ALLOW_ALL = True
CORS_URLS_REGEX = r'^/api/.*$'
+
+WGER_SETTINGS = {
+ 'USE_RECAPTCHA': True
+}
\ No newline at end of file