Exemplo n.º 1
0
def verify_user(email, password):
    hash_pass = to_md5(password)
    user_id = None
    db = get_db_connection()
    cur = db.cursor()
    result = cur.callproc('VERIFY_USER', [email, hash_pass, user_id, ])
    return int(result[2])
Exemplo n.º 2
0
def add_user(user_name, password, email, status_id=1):
    cursor = connection.cursor()
    pass_md5 = to_md5(password)
    request = (
        "INSERT INTO Users(User_name, Password, Status_id, Email) "
        'VALUES("{user_name}", "{password}", {status_id}, "{email}");'
    ).format(user_name=user_name, password=pass_md5, status_id=status_id, email=email)
    cursor.execute(request)
Exemplo n.º 3
0
def verify_user(email, password):
    if has_email(email):
        cursor = connection.cursor()
        sql_get_pass = (
            'SELECT Password, User_id FROM Users WHERE Email="{email}";'
        ).format(email=email)
        cursor.execute(sql_get_pass)
        pass_user_id = cursor.fetchone()

        real_pass = pass_user_id[0]
        user_id = pass_user_id[1]
        received_pass = to_md5(password)
        if real_pass == received_pass:
            return user_id
    return None
Exemplo n.º 4
0
def add_user(user_name, password, email, status_id=1):
    db = get_db_connection()
    cur = db.cursor()
    hash_pass = to_md5(password)
    result = cur.callproc('ADD_USER', [user_name, hash_pass, email, status_id, ])