reg/events.py
changeset 9 e29ecb7819e7
parent 8 e2699e042129
child 17 125b6fc8f20b
equal deleted inserted replaced
8:e2699e042129 9:e29ecb7819e7
    56             new_event.save()
    56             new_event.save()
    57             return new_event
    57             return new_event
    58         except IntegrityError:
    58         except IntegrityError:
    59             pass
    59             pass
    60 
    60 
    61 
       
    62 def activate_user(user):
    61 def activate_user(user):
    63     """ mark the is_active flag as true.
    62     """ mark the is_active flag as true.
    64     """
    63     """
    65 
    64 
    66     user.is_active = True
    65     user.is_active = True
    67     user.save()
    66     user.save()
    68     return user
    67     return user
       
    68 
       
    69 def reset_password(user):
       
    70     """ get a key and set it as password.
       
    71     for now, print the key.
       
    72     later on add the send mail function.
       
    73     """
       
    74 
       
    75     new_password = gen_key(10)
       
    76     user.set_password(new_password)
       
    77     user.save()
       
    78     print "The new password is", new_password
       
    79     return new_password
       
    80 
       
    81 def change_password(user, new_password):
       
    82     """ for now just set the password and be done with it.
       
    83     later on, if we want to do something else also then we can add them here.
       
    84     """
       
    85 
       
    86     user.set_password(new_password)
       
    87     user.save()
       
    88 
       
    89