Skip to content

Instantly share code, notes, and snippets.

@joselluis7
Created May 5, 2020 20:08
Show Gist options
  • Save joselluis7/8bb33cd9fbb05725d54ee32facd511dc to your computer and use it in GitHub Desktop.
Save joselluis7/8bb33cd9fbb05725d54ee32facd511dc to your computer and use it in GitHub Desktop.
@app.route('/')
@app.route('/index', methods=['GET','POST'])
def index():
form_login = LoginForm()
if form_login.validate_on_submit():
user = User.query.filter_by(username=form_login.username.data).first()
if user:
login_user(user)
flash('logged in successfully as {}.'.format(user.username))
next_page = request.args.get('next')
return redirect(next_page or url_for('index'))
flash('Incorrect username or password', 'error')
print("AQUI ESTA O PROBLEMA")
return render_template('index.html', form=form_login)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment