X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/9308d78c7f1e4d2a4faf3b98d1b24c262f3b6287..121349bc707dc31a4e1dd46392960ba02aada1d1:/forum/forms/general.py diff --git a/forum/forms/general.py b/forum/forms/general.py index 1becdf0..e0348a8 100644 --- a/forum/forms/general.py +++ b/forum/forms/general.py @@ -5,9 +5,11 @@ from django.utils.safestring import mark_safe from forum import settings from django.http import str_to_unicode from forum.models import User +from forum.modules import call_all_handlers import urllib +import logging -DEFAULT_NEXT = '/' + getattr(settings, 'FORUM_SCRIPT_ALIAS') +DEFAULT_NEXT = getattr(settings, 'APP_BASE_URL') def clean_next(next): if next is None: return DEFAULT_NEXT @@ -154,3 +156,18 @@ class SetPasswordForm(forms.Form): else: return self.cleaned_data['password2'] +class SimpleCaptchaForm(forms.Form): + fields = {} + + def __init__(self, *args, **kwargs): + super(SimpleCaptchaForm, self).__init__(*args, **kwargs) + + spam_fields = call_all_handlers('create_anti_spam_field') + if spam_fields: + spam_fields = dict(spam_fields) + for name, field in spam_fields.items(): + self.fields[name] = field + + self._anti_spam_fields = spam_fields.keys() + else: + self._anti_spam_fields = []