def __init__(self, created_system=None, valid_until=None): """ Create a new activation, valid_length is in days """ self.code = gen_hash_key(12) self.created_by = created_system if valid_until: self.valid_until = valid_until else: self.valid_until = datetime.utcnow() + timedelta(days=3)
def hash_password(self, password): self.salt = gen_hash_key(24) return unicode(crypt.encode(password + self.salt))