def login(): form = LoginForm() if form.validate_on_submit(): user = User.from_username(str(form.username.data)) if user and user.validate(form.password.data): login_user(user) flash("Logged in successfully.") return form.redirect("index") else: flash("Password incorrect.") return render_template("login.html", form=form, title="Login")
def login(): form = LoginForm() messages = Message.query.filter_by(deleted=False).all() if form.validate_on_submit(): user = User.from_username(str(form.username.data)) if user and user.validate(form.password.data): login_user(user) flash("Logged in successfully.") return form.redirect("planet") else: flash("Password incorrect.") return render_template("login.html", form=form, title="Login", messages=messages)