def generate_activation_key(username):
    """generate activation key with username
    
    originally written by ubernostrum in django-registration_

    .. _django-registration: https://bitbucket.org/ubernostrum/django-registration
    """
    username = force_text(username)
    seed = force_text(random.random())
    salt = sha1(seed.encode('utf-8')).hexdigest()[:5]
    activation_key = sha1((salt+username).encode('utf-8')).hexdigest()
    return activation_key
示例#2
0
def generate_activation_key(username):
    """generate activation key with username
    
    originally written by ubernostrum in django-registration_

    .. _django-registration: https://bitbucket.org/ubernostrum/django-registration
    """
    username = force_text(username)
    seed = force_text(random.random())
    salt = sha1(seed.encode('utf-8')).hexdigest()[:5]
    activation_key = sha1((salt + username).encode('utf-8')).hexdigest()
    return activation_key
def generate_activation_key(username):
    """generate activation key with username
    
    originally written by ubernostrum in django-registration_

    .. _django-registration: https://bitbucket.org/ubernostrum/django-registration
    """
    if not isinstance(username, unicode):
        username = username.decode('utf-8')
    seed = unicode(random.random())
    salt = sha1(seed.encode('utf-8')).hexdigest()[:5]
    activation_key = sha1((salt+username).encode('utf-8')).hexdigest()
    return activation_key
示例#4
0
def generate_activation_key(username):
    """generate activation key with username
    
    originally written by ubernostrum in django-registration_

    .. _django-registration: https://bitbucket.org/ubernostrum/django-registration
    """
    if not isinstance(username, unicode):
        username = username.decode('utf-8')
    seed = unicode(random.random())
    salt = sha1(seed.encode('utf-8')).hexdigest()[:5]
    activation_key = sha1((salt+username).encode('utf-8')).hexdigest()
    return activation_key