def login(): form = LoginForm() if form.validate_on_submit(): email = form.email.data password = form.password.data remember = True if form.remember.data else False user = User.auth(email=email, password=password) if not user: flash("Please check your login details and try again.") return redirect(url_for("auth.login")) login_user(user=user, remember=remember) return redirect(url_for("main.profile")) return render_template("login.html", form=form)
def login(): form = LoginForm() if request.method == 'POST' and form.validate_on_submit(): user, authenticated = User.auth(db.session.query, form.login_id.data, form.password.data) if authenticated: login_user(user) # flash('ログインしました。', 'success') return redirect(url_for('view.order')) flash('ログインIDかパスワードが違います', 'danger') return render_template('login.html', form=form)