Browse Source

Use captcha after some failed logins

sh4nks 9 years ago
parent
commit
e72e0da974
2 changed files with 11 additions and 0 deletions
  1. 7 0
      flaskbb/fixtures/settings.py
  2. 4 0
      flaskbb/templates/auth/login.html

+ 7 - 0
flaskbb/fixtures/settings.py

@@ -97,6 +97,13 @@ fixture = (
                 'name':         "Login Timeout",
                 'description':  "The time of how long a account will stay suspended until the user can try to login again (in minutes).",
             }),
+            ('login_recaptcha', {
+                'value':        3,
+                'value_type':   "integer",
+                'extra':        {'min': 0},
+                'name':         "Login reCAPTCHA",
+                'description':  "Use a CAPTCHA after a specified amount of failed login attempts."
+            }),
             ('recaptcha_enabled', {
                 'value':        False,
                 'value_type':   "boolean",

+ 4 - 0
flaskbb/templates/auth/login.html

@@ -15,6 +15,10 @@
             {{ horizontal_field(form.login)}}
             {{ horizontal_field(form.password)}}
             {{ horizontal_field(form.remember_me) }}
+            {% if flaskbb_config["RECAPTCHA_ENABLED"] and login_recaptcha %}
+                {{ horizontal_field(form.recaptcha) }}
+            {% endif %}
+
             {{ horizontal_field(form.submit) }}
 
             <div class="form-group">