Пример #1
0
def register_user_():
    js = request.get_json(force=True)
    email = js.get('email')
    password = js.get('password')
    fname = js.get('fname')
    lname = js.get('lname')

    #Missing arguments
    if not email or not password or not fname or not lname:
        return abort(400)
    fname = formatting.stringify_sql(fname)
    lname = formatting.stringify_sql(lname)
    email = formatting.stringify_sql(email)

    if giftlydb.insert_user(
        (giftlydb.generate_uuid(), email, fname, lname,
         formatting.stringify_sql(encryption.hash_password(password)), '1')):
        values = giftlydb.select_values(values="USERID, EMAIL, FNAME, LNAME",
                                        table="User",
                                        where="EMAIL=" + email)
        value_dict = giftlydb.row_to_dict(values)
        userid = value_dict[0]['userid']
        email = value_dict[0]['email']
        lname = value_dict[0]['lname']
        fname = value_dict[0]['fname']
        return jsonify(
            formatting.format_user_json(userid=userid,
                                        email=email,
                                        lname=lname,
                                        fname=fname))
    else:
        return abort(400)
Пример #2
0
def add_user_friend():
    userid = request.json.get('userid')
    name = request.json.get('name')
    dob = request.json.get('dob')
    success = False
    if userid and name and dob:
        name = formatting.stringify_sql(name)
        dob = formatting.stringify_sql(dob)
        success = giftlydb.insert_friend((giftlydb.generate_uuid(), userid, name, dob, '1'))

    return jsonify(giftlydb.get_friend_dict(name))
Пример #3
0
def add_user_friend():
    userid = request.json.get('userid')
    name = request.json.get('name')
    dob = request.json.get('dob')
    success = False
    if userid and name and dob:
        name = formatting.stringify_sql(name)
        dob = formatting.stringify_sql(dob)
        success = giftlydb.insert_friend(
            (giftlydb.generate_uuid(), userid, name, dob, '1'))

    return jsonify(giftlydb.get_friend_dict(name))
Пример #4
0
def register_user_():
    js = request.get_json(force=True)
    email = js.get('email')
    password = js.get('password')
    fname = js.get('fname')
    lname = js.get('lname')

    #Missing arguments
    if not email or not password or not fname or not lname:
        return abort(400)
    fname = formatting.stringify_sql(fname)
    lname = formatting.stringify_sql(lname)
    email = formatting.stringify_sql(email)

    if giftlydb.insert_user((giftlydb.generate_uuid(), email, fname, lname, formatting.stringify_sql(encryption.hash_password(password)), '1')):
        values = giftlydb.select_values(values="USERID, EMAIL, FNAME, LNAME", table="User", where="EMAIL="+email)
        value_dict = giftlydb.row_to_dict(values)
        userid = value_dict[0]['userid']
        email = value_dict[0]['email']
        lname = value_dict[0]['lname']
        fname = value_dict[0]['fname']
        return jsonify(formatting.format_user_json(userid=userid, email=email, lname=lname, fname=fname))
    else:
        return abort(400)