Beispiel #1
0
def login_admin():
    if request.method == "POST":
        username = request.form.get("username")
        password = request.form.get("password")
        user = dao.check_login(username=username, password=password)
        if user:
            login_user(user=user)
    return redirect("admin")
Beispiel #2
0
def login():
    err_msg = ""
    if request.method == 'POST':
        username = request.form.get("username")
        password = request.form.get("password")
        user = dao.check_login(username=username, password=password)
        if user:
            # Login Thanh cong
            session["user"] = user
            if "next" in request.args:
                return redirect(request.args["next"])
            return redirect(url_for('index'))
        else:
            err_msg = "Something Wrong"
    return render_template("login.html", err_msg=err_msg)
Beispiel #3
0
def signin_user():
    err_msg = ""
    if request.method == 'POST':
        username = request.form.get("username")
        password = request.form.get("password")
        user = dao.check_login(username=username, password=password)
        if user:
            login_user(user=user)
            if "next" in request.args:
                return redirect(request.args["next"])

            return redirect(url_for('index'))
        else:
            err_msg = "Something wrong!!!"

    return render_template("login.html", err_msg=err_msg)