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 .
--- 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()
--- 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.<br />
{% else %}
Welcome {{user.get_full_name}}<br /><br >
- {% endif %}
-
- {% if user.is_active and registered_events %}
- You have registered for the following workshops:
- <ul>
- {% for a_event in registered_events %}
- <li><a href="/reg/event/view/{{a_event.key}}">{{a_event.title}}</a></li>
- {% endfor %}
- </ul>
+
+
+ {% if user.is_active %}
+ {% if registered_events %}
+ You have registered for the following workshops:
+ <ul>
+ {% for a_event in registered_events %}
+ <li><a href="/reg/event/view/{{a_event.key}}">{{a_event.title}}</a></li>
+ {% endfor %}
+ </ul>
+ {% endif %}
+ {% else %}
+ Your account is inactive. An activation email has been sent to your email address.<br />
+ <a href="/reg/resend_activation/?email={{email}}">Click here</a> to resend the activation email.<br />
+ {% endif %}
{% endif %}
{% if user.is_staff %}