# HG changeset patch # User nishanth # Date 1271331196 -19800 # Node ID fd37bbece439fabae3e64c40cc042e9d4e8e06e9 # Parent 4c1d3fe9fef15f481bc00e61b98f8c1af8dc737a now a user can login even if he is not active. he gets account inactive message on homepage. we have to make changes to other views suitably . diff -r 4c1d3fe9fef1 -r fd37bbece439 reg/views.py --- a/reg/views.py Thu Apr 15 16:40:30 2010 +0530 +++ b/reg/views.py Thu Apr 15 17:03:16 2010 +0530 @@ -44,12 +44,9 @@ password = form.cleaned_data['password'] username = User.objects.get(email__iexact=email).username - user = authenticate(username=username, password=password) - if user.is_active: - login(request, user) - return redirect('/reg') - else: - return render_to_response('account_inactive.html', {'email':email}) + new_user = authenticate(username=username, password=password) + login(request, new_user) + return redirect('/reg') else: return render_to_response('login.html', {'user':user, 'form':form}) else: @@ -134,6 +131,9 @@ """ user = request.user + if not user.is_authenticated(): + raise Http404 + try: email = request.GET['email'] except MultiValueDictKeyError: @@ -361,7 +361,7 @@ """ user = request.user - if not user.is_authenticated(): + if not ( user.is_authenticated() and user.is_active ): return redirect('/reg') user_profile = user.get_profile() diff -r 4c1d3fe9fef1 -r fd37bbece439 templates/index.html --- a/templates/index.html Thu Apr 15 16:40:30 2010 +0530 +++ b/templates/index.html Thu Apr 15 17:03:16 2010 +0530 @@ -6,15 +6,21 @@ You can know about workshops by clicking on workshops link on the left.
{% else %} Welcome {{user.get_full_name}}

- {% endif %} - - {% if user.is_active and registered_events %} - You have registered for the following workshops: - + + + {% if user.is_active %} + {% if registered_events %} + You have registered for the following workshops: + + {% endif %} + {% else %} + Your account is inactive. An activation email has been sent to your email address.
+ Click here to resend the activation email.
+ {% endif %} {% endif %} {% if user.is_staff %}