Esempio n. 1
0
def check_password(username, password):
    pw_hash = redis.hget('user:passwords', slug(username))
    if pw_hash is None:
        return None
    if check_password_hash(pw_hash, password):
        return True
    return False
Esempio n. 2
0
def register_user(key, username, password):
    if not password:
        return False
    if not check_invite(key):
        return False
    email = redis.hget('user:keys', key)
    username = slug(username)
    if redis.hexists('user:passwords', username):
        return False
    set_email(username, email)
    set_password(username, password)
    redis.hdel('user:keys', key)
    return {
        'username': username,
        'email': email
    }
Esempio n. 3
0
def set_password(username, password):
    redis.hset('user:passwords', slug(username), generate_password_hash(password))
Esempio n. 4
0
def get_email(username, email):
    redis.hset('user:emails', slug(username))
Esempio n. 5
0
def user_exists(username):
    return redis.hexists('user:passwords', slug(username))
Esempio n. 6
0
def to_slug(src):
    if ':' in src:
        left, _, right  = src.partition(':')
        return '%s:%s' % (schema.slug(left), schema.slug(right))
    return schema.slug(src)