Exemplo n.º 1
0
    def __init__(self, created_by='web', valid_until=None):
        """Create a new activation. *valid_until* is a datetime.
        It defaults to 3 days from current day.
        """
        self.code = generate_random_string(12)
        self.created_by = created_by

        if valid_until:
            self.valid_until = valid_until
        else:
            self.valid_until = datetime.utcnow() + timedelta(days=3)
Exemplo n.º 2
0
 def generate_random_password(cls, chars=12):
     """ generates random string of fixed length"""
     return generate_random_string(chars)
Exemplo n.º 3
0
    def _hash_password(self, password):
        if not self.salt:
            self.salt = generate_random_string(24)

        return unicode(crypt.encode(password + self.salt))
Exemplo n.º 4
0
def default_security_code():
    return generate_random_string(12)
Exemplo n.º 5
0
 def generate_random_password(cls, chars=12):
     """ generates random string of fixed length"""
     return generate_random_string(chars)
Exemplo n.º 6
0
    def _hash_password(self, password):
        if not self.salt:
            self.salt = generate_random_string(24)

        return unicode(crypt.encode(password + self.salt))
Exemplo n.º 7
0
def default_security_code():
    return generate_random_string(12)