コード例 #1
0
def login_admin():
    if request.method == 'POST':
        username = request.form.get('username')
        password = request.form.get('password')

        user = dao.validate_user(username=username, password=password)
        if user:
            login_user(user=user)
    return redirect('/admin')
コード例 #2
0
def login():
    err_msg = ""
    if request.method == "POST":
        username = request.form.get("username")
        password = request.form.get("password")
        user = dao.validate_user(username=username, password=password)
        if user:
            session["user"] = user
            if "next" in request.args:
                return redirect(request.args["next"])
            return redirect(url_for("index"))
        else:
            err_msg = "Đăng nhập không thành công"
    return render_template("login.html", err_msg=err_msg)
コード例 #3
0
def login_users():
    msg_err = ""
    
    if request.method == 'POST':
        username = request.form.get('username')
        password = request.form.get('password')

        user = dao.validate_user(username, password)
        if user:
            login_user(user=user)
            return redirect('/')
        else:
            msg_err = "Đăng nhập không thành công"

    return render_template('login.html', msg_err=msg_err)
コード例 #4
0
ファイル: main.py プロジェクト: huyenkhanh295/saleappv1
def login():
    err_msg = ""
    if request.method == "POST":
        # neu co truyen thi tra ve con ko tra ve none
        username = request.form.get("username")
        password = request.form.get("password")

        user = dao.validate_user(username=username, password=password)
        if user:
            session["user"] = user

            if "next" in request.args:
                return redirect(request.args["next"])

            return redirect(url_for("index"))
        else:
            err_msg = "Dang nhap khong thanh cong"

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