from app.auth.forms import LoginForm from app.models import User from flask import flash, redirect, render_template, request, url_for from flask_login import login_required, login_user from . import main @main.route('/', methods=['GET', 'POST']) def index(): login_form = LoginForm(prefix='login-form') if login_form.validate_on_submit(): user = User.query.filter_by(email=login_form.user.data).first() if user is None: user = User.query.filter_by(username=login_form.user.data).first() if user is not None and user.verify_password(login_form.password.data): login_user(user, login_form.remember_me.data) next = request.args.get('next') if next is None or not next.startswith('/'): next = url_for('main.dashboard') return redirect(next) flash('Invalid username or password.') return render_template('main/index.html.j2', login_form=login_form, title='nopaque') @main.route('/dashboard') @login_required def dashboard(): return render_template('main/dashboard.html.j2', title='Dashboard') @main.route('/poster') def poster(): return render_template('main/poster.html.j2', title='Dienste und Prozesse') @main.route('/poster2') def poster2(): return render_template('main/poster2.html.j2', title='Dienste und Prozesse')