Captcha support¶
Users can be required to enter a captcha.
This is done by changing the FLUENT_COMMENTS_FORM_CLASS setting.
Note
When FLUENT_COMMENTS_FIELD_ORDER is configured, also include the "captcha"
field!
Using django-recaptcha¶
django-recaptcha provides “no captcha” reCAPTCHA v2 support. Choose one of the form layout classes:
FLUENT_COMMENTS_FORM_CLASS = 'fluent_comments.forms.recaptcha.DefaultCommentForm' # default
FLUENT_COMMENTS_FORM_CLASS = 'fluent_comments.forms.recaptcha.CompactLabelsCommentForm' # no labels
FLUENT_COMMENTS_FORM_CLASS = 'fluent_comments.forms.recaptcha.CompactCommentForm' # compact row
And configure it’s settings:
RECAPTCHA_PUBLIC_KEY = "the Google provided site_key"
RECAPTCHA_PRIVATE_KEY = "the Google provided secret_key"
NOCAPTCHA = True # Important! Required to get "no captcha" reCAPTCHA v2
INSTALLED_APPS += (
'captcha',
)
Using django-nocaptcha-recaptcha¶
django-nocaptcha-recaptcha also provides “no captcha” reCAPTCHA v2 support. The same form classes are used, as the correct imports are detected at startup:
FLUENT_COMMENTS_FORM_CLASS = 'fluent_comments.forms.recaptcha.DefaultCommentForm' # default
FLUENT_COMMENTS_FORM_CLASS = 'fluent_comments.forms.recaptcha.CompactLabelsCommentForm' # no labels
FLUENT_COMMENTS_FORM_CLASS = 'fluent_comments.forms.recaptcha.CompactCommentForm' # compact row
It’s settings differ slightly:
NORECAPTCHA_SITE_KEY = "the Google provided site_key"
NORECAPTCHA_SECRET_KEY = "the Google provided secret_key"
INSTALLED_APPS += (
'nocaptcha_recaptcha',
)
Using django-simple-captcha¶
django-simple-captcha provides a simple local captcha test. It does not require external services, but it can be easier to break.
FLUENT_COMMENTS_FORM_CLASS = 'fluent_comments.forms.captcha.DefaultCommentForm' # default
FLUENT_COMMENTS_FORM_CLASS = 'fluent_comments.forms.captcha.CompactLabelsCommentForm' # no labels
FLUENT_COMMENTS_FORM_CLASS = 'fluent_comments.forms.captcha.CompactCommentForm' # compact row
And configure the app:
CAPTCHA_NOISE_FUNCTIONS = ()
CAPTCHA_FONT_SIZE = 30
CAPTCHA_LETTER_ROTATION = (-10,10)
INSTALLED_APPS += (
'captcha',
)
Warning
Note that both django-simple-captcha and django-recaptcha use the same “captcha” module name. These packages can’t be installed together.