now an email will be sent to user after he resets his password.
authornishanth
Fri, 23 Apr 2010 16:35:42 +0530
changeset 98 1af134a1e53d
parent 97 87d522d28a28
child 99 cc2ed87ee896
now an email will be sent to user after he resets his password.
reg/events.py
reg/views.py
templates/password_reset.html
--- a/reg/events.py	Sat Apr 17 14:59:58 2010 +0530
+++ b/reg/events.py	Fri Apr 23 16:35:42 2010 +0530
@@ -100,6 +100,24 @@
     new_password = gen_key(10)
     user.set_password(new_password)
     user.save()
+
+    subject = "Password on FOSSEE registration"
+    message = """
+    Dear %s,
+
+    Your new password is "%s".
+    This password can be changed using the "change password" link available in "My Profile" page after you login.
+ 
+    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(), new_password)
+
+    send_mail(subject, message, "admin@fossee.in", [user.email])
+
     return new_password
 
 def change_password(user, new_password):
--- a/reg/views.py	Sat Apr 17 14:59:58 2010 +0530
+++ b/reg/views.py	Fri Apr 23 16:35:42 2010 +0530
@@ -224,6 +224,7 @@
             email = form.cleaned_data['email']
             user = User.objects.get(email__iexact=email)
             new_password = reg_events.reset_password(user)
+            reg_events.mail_password(user, new_password)
             return render_to_response('password_reset.html', {'user':user, 'new_password':new_password})
         else:
             return render_to_response('password_reset.html', {'user':user, 'form':form})
--- a/templates/password_reset.html	Sat Apr 17 14:59:58 2010 +0530
+++ b/templates/password_reset.html	Fri Apr 23 16:35:42 2010 +0530
@@ -1,7 +1,7 @@
 {% extends "base.html" %}
 {% block content %}
 	{% if new_password %}
-		Your password is "{{ new_password }}". This will be sent to your email id when app is on FOSSEE.<br />
+		Your password has been sent to your email address.<br />
 		<a href="/workshop/registration">Click here</a> to return to home page.
 	{% else %}
 		<form action="" method="post">