diff --git a/registration/backends/default/views.py b/registration/backends/default/views.py index ada20499..54504d93 100644 --- a/registration/backends/default/views.py +++ b/registration/backends/default/views.py @@ -240,7 +240,7 @@ def LoginView(request): #return HttpResponseRedirect(request.META.get('HTTP_REFERER','/')) else: response={'success':False, 'errors': form.errors} - if getattr(form, 'inactive'): + if getattr(form, 'inactive', None): response.update({'inactive': True}) return HttpResponse(json.dumps(response), content_type='application/json') diff --git a/registration/forms.py b/registration/forms.py index 1a957bc1..8c6e718b 100644 --- a/registration/forms.py +++ b/registration/forms.py @@ -130,6 +130,7 @@ class RegistrationFormNoFreeEmail(RegistrationForm): from django.contrib.auth import authenticate class LoginForm(AuthenticationForm): + inactive = False def clean(self): username = self.cleaned_data.get('username') password = self.cleaned_data.get('password') @@ -147,7 +148,7 @@ class LoginForm(AuthenticationForm): elif not self.user_cache.is_active: - self._errors['username'] = ErrorList(self.error_messages['inactive']) + self._errors['username'] = ErrorList([self.error_messages['inactive']]) self.inactive = True del data['username']