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')
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)
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)
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)