bruteforcesettings.py 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. # Register and Sign-In Settings
  5. ('brute-force', {
  6. 'name': _("Brute-force Countermeasures"),
  7. 'description': _("Those settings allow you to protect your forum from brute-force attacks."),
  8. 'settings': (
  9. ('attempts_limit', {
  10. 'value': 3,
  11. 'default': 3,
  12. 'type': "integer",
  13. 'input': "text",
  14. 'separator': _("Brute-force Countermeasures"),
  15. 'name': _("IP invalid attempts limit"),
  16. 'description': _('Enter maximal number of allowed attempts before IP address "jams". Defautly forum records only failed sign-in attempts.'),
  17. }),
  18. ('registrations_jams', {
  19. 'value': False,
  20. 'default': False,
  21. 'type': "boolean",
  22. 'input': "yesno",
  23. 'name': _("Protect register form"),
  24. 'description': _("Set this setting to yes if you want failed register attempts to count into limit. Majority of failed register attempts are caused by CAPTCHA protection against spam-bots, however same protection may cause problems for users with disabilities or ones that have problems understanding Q&A challenge."),
  25. }),
  26. ('jams_lifetime', {
  27. 'value': 15,
  28. 'default': 15,
  29. 'type': "integer",
  30. 'input': "text",
  31. 'name': _("Automaticaly unlock jammed IPs"),
  32. 'description': _('Enter number of minutes since IP address "jams" to automatically unlock it, or 0 to never unlock jammed IP adresses. Jams don\'t count as bans.'),
  33. }),
  34. ),
  35. }),
  36. )
  37. def load():
  38. load_settings_fixture(settings_fixture)
  39. def update():
  40. update_settings_fixture(settings_fixture)