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 }
def set(id, value): if value: redis.hset(REDIS_SESSION, id, value) else: redis.hdel(REDIS_SESSION, id)