reg/events.py
changeset 9 e29ecb7819e7
parent 8 e2699e042129
child 17 125b6fc8f20b
--- a/reg/events.py	Fri Apr 09 16:51:56 2010 +0530
+++ b/reg/events.py	Mon Apr 12 02:57:25 2010 +0530
@@ -58,7 +58,6 @@
         except IntegrityError:
             pass
 
-
 def activate_user(user):
     """ mark the is_active flag as true.
     """
@@ -66,3 +65,25 @@
     user.is_active = True
     user.save()
     return user
+
+def reset_password(user):
+    """ get a key and set it as password.
+    for now, print the key.
+    later on add the send mail function.
+    """
+
+    new_password = gen_key(10)
+    user.set_password(new_password)
+    user.save()
+    print "The new password is", new_password
+    return new_password
+
+def change_password(user, new_password):
+    """ for now just set the password and be done with it.
+    later on, if we want to do something else also then we can add them here.
+    """
+
+    user.set_password(new_password)
+    user.save()
+
+