Restructure project

This commit is contained in:
Patrick Jentsch
2022-09-02 13:07:30 +02:00
parent ec9225b881
commit 8e1d94bb5d
73 changed files with 2105 additions and 2468 deletions

View File

@ -1,30 +1,27 @@
from app.auth.forms import LoginForm
from app.models import User
from flask import flash, redirect, render_template, url_for
from flask_login import login_required, login_user
from app.auth.forms import LoginForm
from app.models import User
from . import bp
@bp.route('/', methods=['GET', 'POST'])
@bp.route('', methods=['GET', 'POST'])
def index():
form = LoginForm(prefix='login-form')
if form.validate_on_submit():
user = User.query.filter_by(username=form.user.data).first()
if user is None:
user = User.query.filter_by(email=form.user.data.lower()).first()
if user is not None and user.verify_password(form.password.data):
user = User.query.filter((User.email == form.user.data.lower()) | (User.username == form.user.data)).first()
if user and user.verify_password(form.password.data):
login_user(user, form.remember_me.data)
flash('You have been logged in')
return redirect(url_for('.dashboard'))
flash('Invalid email/username or password.')
flash('Invalid email/username or password', category='error')
redirect(url_for('.index'))
return render_template('main/index.html.j2', form=form, title='nopaque')
@bp.route('/faq')
def faq():
return render_template(
'main/faq.html.j2',
title='Frequently Asked Questions'
)
return render_template('main/faq.html.j2', title='Frequently Asked Questions')
@bp.route('/dashboard')
@ -45,10 +42,7 @@ def news():
@bp.route('/privacy_policy')
def privacy_policy():
return render_template(
'main/privacy_policy.html.j2',
title='Privacy statement (GDPR)'
)
return render_template('main/privacy_policy.html.j2', title='Privacy statement (GDPR)')
@bp.route('/terms_of_use')