Example #1
0
def home():
    form = SignIn()
    if request.method == "GET":
        return render_template("home.html", form=form)

    elif request.method == "POST":
        if form.validate() == True:
            userData = userAuth(form.username.data, form.password.data)
            session["email"] = userData["email"]
            return redirect(url_for("myprofile"))
        elif form.validate() == False:
            flash("All fields are required")
            return render_template("signin.html", form=form)

    else:
        flash("Your username/email or password is incorrect")
        return render_template("signin.html")