예제 #1
0
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")
예제 #2
0
파일: login.py 프로젝트: Jujuedv/destynywar
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)