captchasettings.py 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. from misago.utils.fixtures import load_settings_fixture, update_settings_fixture
  2. from misago.utils.translation import ugettext_lazy as _
  3. settings_fixture = (
  4. # Spam Countermeasures
  5. ('captcha', {
  6. 'name': _("Spam Countermeasures"),
  7. 'description': _("Those settings allow you to combat automatic registrations and spam messages on your forum."),
  8. 'settings': (
  9. ('bots_registration', {
  10. 'value': 'no',
  11. 'type': "string",
  12. 'input': "choice",
  13. 'extra': {'choices': [('no', _("No protection")), ('recaptcha', _("reCaptcha")), ('qa', _("Question & Answer"))]},
  14. 'separator': _("Spambots Registrations"),
  15. 'name': _("CAPTCHA type"),
  16. 'description': _('CAPTCHA stands for "Completely Automated Public Turing test to tell Computers and Humans Apart". Its type of test developed on purpose of blocking automatic registrations.'),
  17. }),
  18. ('recaptcha_public', {
  19. 'type': "string",
  20. 'input': "text",
  21. 'separator': _("reCaptcha"),
  22. 'name': _("Public Key"),
  23. 'description': _("Enter public API key that you have received from reCaptcha."),
  24. }),
  25. ('recaptcha_private', {
  26. 'type': "string",
  27. 'input': "text",
  28. 'name': _("Private Key"),
  29. 'description': _("Enter private API key that you have received from reCaptcha."),
  30. }),
  31. ('recaptcha_ssl', {
  32. 'value': False,
  33. 'type': "boolean",
  34. 'input': "yesno",
  35. 'name': _("Use SSL in reCaptcha"),
  36. 'description': _("Do you want forum to use SSL when making requests to reCaptha servers?"),
  37. }),
  38. ('qa_test', {
  39. 'type': "string",
  40. 'input': "text",
  41. 'separator': _("Question and Answer Test"),
  42. 'name': _("Question"),
  43. 'description': _("Question visible to your users."),
  44. }),
  45. ('qa_test_help', {
  46. 'type': "string",
  47. 'input': "text",
  48. 'name': _("Help Message"),
  49. 'description': _("Optional help message displayed on form."),
  50. }),
  51. ('qa_test_answers', {
  52. 'type': "string",
  53. 'input': "textarea",
  54. 'name': _("Answers"),
  55. 'description': _("Enter allowed answers to this question, each in new line. Test is case-insensitive."),
  56. }),
  57. ),
  58. }),
  59. )
  60. def load():
  61. load_settings_fixture(settings_fixture)
  62. def update():
  63. update_settings_fixture(settings_fixture)