make recaptcha optional #80 #134

This commit is contained in:
rimu 2024-03-31 11:42:34 +13:00
parent 85939c27d4
commit fc36ede2b0
2 changed files with 5 additions and 2 deletions

View file

@ -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():

View file

@ -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)))