Ejemplo n.º 1
0
def userinfo(QQ, name, password):
    pool_flag = session.get(POOL_FLAG)
    conn = get_redis_conn(pool_flag)
    if check_password(conn, QQ, password):
        user = UserInfo(QQ)
        result = user.load_from_redis(QQ)
        if result != None:
            result = dict(finish=1, user=user.to_dict())
            return json.dumps(result, ensure_ascii=False)
        else:
            result = dict(finish=0)
            return json.dumps(result, ensure_ascii=False)
    else:
        result = dict(finish=0)
        return json.dumps(result, ensure_ascii=False)
Ejemplo n.º 2
0
def userinfo(QQ, name, password):
    pool_flag = session.get(POOL_FLAG)
    # 当前后端域名:端口不一致时,cookie无法跨站传输,导致session为空,故需要再判断一次
    if not pool_flag:
      host = judge_pool()
      conn = get_redis_conn(host)
    else:
      conn = get_redis_conn(pool_flag)
    if check_password(conn, QQ, password):
        user = UserInfo(QQ)
        result = user.load_from_redis(QQ)
        if result != None:
            result = dict(finish=1, user=user.to_dict())
            return json.dumps(result, ensure_ascii=False)
        else:
            result = dict(finish=0)
            return json.dumps(result, ensure_ascii=False)
    else:
        result = dict(finish=0)
        return json.dumps(result, ensure_ascii=False)