def login_check(): form = LoginForm() if form.validate(): user_to_login = mongo.get_user_obj(request.form["username"]) if user_to_login and user_to_login.validate_login(request.form["password"]): login_user(user_to_login) return redirect(url_for("views.home")) else: flash("username or password incorrect") return redirect(url_for("views.login")) else: flash("username or password incorrect") return redirect(url_for("views.login"))
def load_user(username): return mongo.get_user_obj(username)
def user(username, page=1): user = mongo.get_user_obj(username) if user is None: flash("User %s not found" % username) return redirect(url_for("views.index")) return render_template("user.html", user=user)