|
|
|
|
108
|
return redirect(request.GET.get('next') or '/')
|
108
|
return redirect(request.GET.get('next') or '/')
|
109
|
else:
|
109
|
else:
|
110
|
username = form.cleaned_data.get('username')
|
110
|
username = form.cleaned_data.get('username')
|
111
|
- user = User.objects.get(username=username)
|
|
|
112
|
- if user.is_active:
|
|
|
|
|
111
|
+ try:
|
|
|
112
|
+ user = User.objects.get(username=username)
|
|
|
113
|
+ except User.DoesNotExist:
|
|
|
114
|
+ is_active = True
|
|
|
115
|
+ else:
|
|
|
116
|
+ is_active = user.is_active
|
|
|
117
|
+ if is_active:
|
113
|
if parameter.get(parameter.USERS_SELF_REGISTRATION):
|
118
|
if parameter.get(parameter.USERS_SELF_REGISTRATION):
|
114
|
messages.error(request, _('Login failed! You can do a password recorvery <a href="%(url_recover)s">here</a> or you can register <a href="%(url_register)s">here</a>.') %
|
119
|
messages.error(request, _('Login failed! You can do a password recorvery <a href="%(url_recover)s">here</a> or you can register <a href="%(url_register)s">here</a>.') %
|
115
|
{'url_register': users.url_register(request), 'url_recover': users.url_password_recovery(request)})
|
120
|
{'url_register': users.url_register(request), 'url_recover': users.url_password_recovery(request)})
|