In a model add:
ip = request.env.remote_addr
MAX_LOGIN_FAILURES = 3
num_login_attempts = memcache.get(ip) or 0
if num_login_attempts >= MAX_LOGIN_FAILURES:
auth.settings.login_captcha = Recaptcha(request, ...)
def login_attempt(form):
memcache.set(ip, num_login_attempts + 1)
auth.settings.login_onvalidation.append(login_attempt)
def login_success(form):
memcache.set(ip, 0)
auth.settings.login_onaccept.append(login_success)
Comments (3)
0
fabianoengler 14 years ago
0
richard 14 years ago
0
villas 13 years ago