From 2cfafb22e9d783a0efdbdff4897f85db4f10a4fa Mon Sep 17 00:00:00 2001 From: zhengxie Date: Sat, 23 Apr 2016 14:24:48 +0800 Subject: [PATCH] Show account freeze error --- seahub/auth/views.py | 1 + seahub/templates/registration/login.html | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/seahub/auth/views.py b/seahub/auth/views.py index c2d5c78b6f..5ab1f1499d 100644 --- a/seahub/auth/views.py +++ b/seahub/auth/views.py @@ -162,6 +162,7 @@ def login(request, template_name='registration/login.html', user.freeze_user(notify_admins=True) except User.DoesNotExist: pass + form.errors['freeze_account'] = _('This account has been frozen due to too many failed login attempts.') else: # log user in if password is valid otherwise show captcha form = CaptchaAuthenticationForm(data=request.POST) diff --git a/seahub/templates/registration/login.html b/seahub/templates/registration/login.html index be4b50e9ac..f2b560253d 100644 --- a/seahub/templates/registration/login.html +++ b/seahub/templates/registration/login.html @@ -20,9 +20,11 @@ {% if form.errors %} {% if form.captcha.errors %} -

{{ form.captcha.errors}}

+

{{ form.captcha.errors}}

+ {% elif form.errors.freeze_account %} +

{{ form.errors.freeze_account }}

{% else %} -

{% trans "Incorrect email or password" %}

+

{% trans "Incorrect email or password" %}

{% endif %} {% else %}