Add redirect for login page if the user is already loged in.

This commit is contained in:
Patrick Jentsch 2019-08-02 13:30:43 +02:00
parent 0de63e2b4b
commit a49e862432

View File

@ -9,6 +9,8 @@ from ..models import User
@auth.route('/login', methods=['GET', 'POST'])
def login():
if current_user.is_authenticated:
return redirect(url_for('main.index'))
form = LoginForm()
if form.validate_on_submit():
user = User.query.filter_by(email=form.login.data).first()