Example #1
0
def add_newuser():
    validation_check = Users.validate_user(request.form)
    if not validation_check:
        return redirect("/")
    else:
        flash("Successfully registered, Please login!!!")
        new_user = Users.add_new_user(request.form)
        session["user_id"] = new_user.id
        return redirect("/")
def add_newuser():
    validation_check = Users.validate_user(request.form)
    if not validation_check:
        return redirect("/")
    else:
        flash("Successfully registered")
        new_user = Users.add_new_user(request.form)
        session["user_id"] = new_user.id
        session["first_name"] = new_user.first_name
        print(session["first_name"])
        return redirect("/dashboard")
Example #3
0
def add_newuser():
    validation_check = Users.validate_user(request.form)
    if not validation_check:
        return redirect("/")
    else:

        new_user = Users.add_new_user(request.form)
        session["user_id"] = new_user.id
        session["name"] = new_user.name
        print(session["user_id"])
        print(session["name"])
        return redirect("/orders")
def registration():
    validation_check = Users.validate_user(request.form)
    found = False
    found_user = Users.query.filter_by(email=request.form['email']).all()
    if found_user:
        found = True
        flash("That email already exists in the database", "reg_error")
        return redirect('/')
    if not validation_check:
        print("something went wrong")
        return redirect('/')
    new_user = Users.add_new_user(request.form)
    print(new_user)
    session['logged_in'] = True
    session['user_id'] = new_user.id
    return redirect('/user/' + str(session["user_id"]))