diff options
-rw-r--r-- | app.py | 17 | ||||
-rw-r--r-- | templates/base.html | 2 | ||||
-rw-r--r-- | templates/index.html | 4 |
3 files changed, 11 insertions, 12 deletions
@@ -47,13 +47,16 @@ def read_blacklist(): @app.route('/', methods=['GET', 'POST']) @templated('index.html') def index(): - form = LoginForm(request.form) - if request.method == 'POST' and form.validate(): - if login_user(form.username.data, form.password.data): - flash(u'Erfolgreich eingeloggt', 'success') - return redirect(url_for('settings')) - else: - flash(u'Ungültiger Benutzername und/oder Passwort', 'error') + if not g.user: + form = LoginForm(request.form) + if request.method == 'POST' and form.validate(): + if login_user(form.username.data, form.password.data): + flash(u'Erfolgreich eingeloggt', 'success') + return redirect(url_for('settings')) + else: + flash(u'Ungültiger Benutzername und/oder Passwort', 'error') + else: + return redirect(url_for('settings')) return {'form': form} diff --git a/templates/base.html b/templates/base.html index aa7ff36..5aaa9ff 100644 --- a/templates/base.html +++ b/templates/base.html @@ -25,7 +25,7 @@ <nav id="mainnav"> <ul> <li><a href="http://spline.de">spline.de</a></li> - <li><a href="{{ url_for('about') }}">Über spline accounts</a></li> + <li><a href="{{ url_for('about') }}">FAQ</a></li> </ul> </nav> diff --git a/templates/index.html b/templates/index.html index 6fae303..3e192e5 100644 --- a/templates/index.html +++ b/templates/index.html @@ -2,9 +2,6 @@ {%- from '_macros.html' import render_field %} {%- block content %} -{%- if g.user %} -<p>Hallo {{ session.username }}. <a href="{{ url_for('settings') }}">Einstellungen</a></p> -{%- else %} <form action="{{ url_for('index') }}" method="post" class="form-horizontal"> <h2>Login</h2> <p> @@ -20,6 +17,5 @@ <p class="form-actions"><a href="/register">Account erstellen</a></div> <p class="form-actions"><a href="/lost_password">Passwort vergessen</a></div> </form> -{%- endif %} {%- endblock %} |