Beispiel #1
0
def signup():

    if request.method == 'POST':

        user_info = {}

        user_info['username'] = request.form['username']
        user_info['email'] = request.form['email']
        user_info['password'] = request.form['password']
        user_info['c_type'] = request.form['c_type']
        rpassword = request.form['rpassword']

        if user_exists(user_info['username']) is False:
            if user_info['password'] == rpassword:
                if user_info['c_type'] == 'buyer':
                    user_info['cart'] = []
                create_user(user_info)
                session['username'] = user_info['username']
                return redirect(url_for('home'))
            return "passwords don't match. Re-enter the password accurately"
        return "user exists already. Enter another username"

    else:

        return redirect(url_for('home'))
Beispiel #2
0
def signup():

    user_info = {}

    user_info['username'] = request.form['username']
    user_info['email'] = request.form['email']
    user_info['password'] = request.form['password']
    rpassword = request.form['rpassword']

    if user_exists(user_info['username']) is False:
        if user_info['password'] == rpassword:
            create_user(user_info)
            return "user created"
Beispiel #3
0
def signup():

    if request.method == 'POST':  #req.method -
        username = request.form[
            "username"]  # request.form - is a dictionary for storing the information from POST
        password1 = request.form["password1"]
        password2 = request.form["password2"]
        typev = request.form["type"]
        print(username, password1, typev)
        if (existing_user(username)):
            return "User already exists"
        create_user(username, password1, typev)
        session["username"] = username
        session["type"] = typev
        return redirect(url_for('home'))
Beispiel #4
0
def signup():
    if request.method == 'POST':
        user_info = {}
        user_info['username'] = request.form['username']
        user_info['email'] = request.form['email']
        user_info['password'] = request.form['password']
        rpassword = request.form['rpassword']
        user_info['c_type'] = request.form['c_type']

        if user_exists(user_info['username']) is False:
            if user_info['password'] == rpassword:
                if user_info['c_type'] == 'buyer':
                    user_info['cart'] = {}
                create_user(user_info)
                return redirect(url_for('home'))
            return "Passwords don't match"
        return 'User Exists'
    return (url_for('home'))
Beispiel #5
0
def signup():

    if request.method == 'POST':
        user_info = {}

        user_info['username'] = request.form['username']
        user_info['email'] = request.form['email']
        user_info['password'] = request.form['password']
        user_info['c_type'] = request.form['c_type']
        rpassword = request.form['rpassword']

        if user_exists(user_info['username']) is False:
            if user_info['password'] == rpassword:
                if user_info['c_type'] == 'buyer':
                    user_info['cart'] = {}
                create_user(user_info)
                return render_template(url_for(
                    'home'))  #'welcome.html', user = user_info['username'])
            return "Passwords don't match. Re-enter password correctly"
        return "user exists already. Enter new username"
    else:
        return redirect(url_for('home'))
Beispiel #6
0
def signup():
    # return render_template('signup.html')
    if request.method == 'POST':
        # return render_template('signup.html')
        user_info = {}

        user_info['username'] = request.form['username']
        user_info['email'] = request.form['email']
        user_info['password'] = request.form['password']
        user_info['c_type'] = request.form['c_type']
        rpassword = request.form['rpassword']

        if user_exists(user_info['username']) is False:
            if user_info['password'] == rpassword:
                if user_info['c_type'] == 'buyer':
                    user_info['cart'] = {}
                create_user(user_info)
                return render_template('signup.html')
                # return render_template('welcome.html', user= user_info['username'])
            return "Passwords dont match. Please re-enter the password"
        return "User already exists. Enter another username"
    else:
        return render_template('signup.html')