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']) @auth.route('/login', methods=['GET', 'POST'])
def login(): def login():
if current_user.is_authenticated:
return redirect(url_for('main.index'))
form = LoginForm() form = LoginForm()
if form.validate_on_submit(): if form.validate_on_submit():
user = User.query.filter_by(email=form.login.data).first() user = User.query.filter_by(email=form.login.data).first()