Registration and login bugs

remotes/origin/1203
Назар Котюк 11 years ago
parent 9ecf5cbcf8
commit d9c7afb6f3
  1. 2
      registration/backends/default/views.py
  2. 3
      registration/forms.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')

@ -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']

Loading…
Cancel
Save