Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

José Luís joselluis7

🏠
Working from home
View GitHub Profile
View login_endpoint.py
@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))