Created
May 5, 2020 20:08
-
-
Save joselluis7/8bb33cd9fbb05725d54ee32facd511dc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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