implemented send activation. have to test it and do the same for change password.
authornishanth
Thu, 15 Apr 2010 19:53:52 +0530
changeset 58 a26c82f593f0
parent 57 d321a507fc26
child 59 01638380207c
implemented send activation. have to test it and do the same for change password.
reg/events.py
reg/views.py
templates/index.html
--- a/reg/events.py	Thu Apr 15 19:19:08 2010 +0530
+++ b/reg/events.py	Thu Apr 15 19:53:52 2010 +0530
@@ -41,7 +41,26 @@
     """ get key from profile and send an email.
     """
 
-    print "http://localhost:8000/reg/activate/%s"%user.get_profile().activation_key
+    activation_link = "http://localhost:8000/reg/activate/%s"%user.get_profile().activation_key
+    subject = "Activate your account"
+    message = """
+    Dear %s,
+
+    Thank you for registering at fossee.in.
+    Your are just a step away from completeing your registration.
+    Please click on the link below or open the url in your browser to activate your account.
+    %s
+
+    Please mail your queries and complaints to admin@fossee.in.
+
+    If you have not registered at fossee, please ignore this mail.
+
+    Regards,
+    FOSSEE Team
+    """%(user.get_full_name(), activation_link)
+    print message
+    send_mail(subject, message, "admin@fossee.in", [user.email])
+
 
 def create_event(title, description, start_date, stop_date, venue, created_by=None):
     """ make an event and save it.
--- a/reg/views.py	Thu Apr 15 19:19:08 2010 +0530
+++ b/reg/views.py	Thu Apr 15 19:53:52 2010 +0530
@@ -89,11 +89,10 @@
                                               interests=data['interests']
                                              )
 
-            reg_events.send_activation(new_user)
             if event:
                 event.attendees.add(new_user)
                 event.save()
-
+            reg_events.send_activation(new_user)
             return redirect('/reg/account_created')
         else:
             return render_to_response('register.html', {'form':form, 'event':event})
@@ -114,7 +113,7 @@
     """
 
     user = request.user
-    if user.is_authenticated():
+    if user.is_authenticated() and user.is_active:
         return redirect('/reg')
 
     try:
--- a/templates/index.html	Thu Apr 15 19:19:08 2010 +0530
+++ b/templates/index.html	Thu Apr 15 19:53:52 2010 +0530
@@ -19,7 +19,7 @@
 			{% 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 />
+			<a href="/reg/resend_activation/?email={{user.email}}">Click here</a> to resend the activation email.<br />
 		{% endif %}
 	{% endif %}