diff --git a/app/auth/routes.py b/app/auth/routes.py index 1ca6a631..c09a9be7 100644 --- a/app/auth/routes.py +++ b/app/auth/routes.py @@ -88,6 +88,9 @@ def register(): if current_user.is_authenticated: return redirect(url_for('main.index')) form = RegistrationForm() + # Recaptcha is optional + if not current_app.config['RECAPTCHA_PUBLIC_KEY'] or not current_app.config['RECAPTCHA_PRIVATE_KEY']: + del form.recaptcha if g.site.registration_mode != 'RequireApplication': form.question.validators = () if form.validate_on_submit(): diff --git a/config.py b/config.py index cb39d944..7dbe2cc4 100644 --- a/config.py +++ b/config.py @@ -19,8 +19,8 @@ class Config(object): MAIL_FROM = os.environ.get('MAIL_FROM') or None MAIL_ERRORS = os.environ.get('MAIL_ERRORS') is not None ADMINS = os.environ.get('ADMINS') - RECAPTCHA_PUBLIC_KEY = os.environ.get("RECAPTCHA_PUBLIC_KEY") - RECAPTCHA_PRIVATE_KEY = os.environ.get("RECAPTCHA_PRIVATE_KEY") + RECAPTCHA_PUBLIC_KEY = os.environ.get("RECAPTCHA_PUBLIC_KEY") or None + RECAPTCHA_PRIVATE_KEY = os.environ.get("RECAPTCHA_PRIVATE_KEY") or None MODE = os.environ.get('MODE') or 'development' LANGUAGES = ['de', 'en'] FULL_AP_CONTEXT = bool(int(os.environ.get('FULL_AP_CONTEXT', 0)))