summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/login.py1
-rw-r--r--app/views/__init__.py3
-rw-r--r--app/views/login.py4
-rw-r--r--static/css/style.css19
-rw-r--r--templates/layout.jinja9
5 files changed, 34 insertions, 2 deletions
diff --git a/app/login.py b/app/login.py
index f4501c8..be89f09 100644
--- a/app/login.py
+++ b/app/login.py
@@ -10,6 +10,7 @@ from . import model
login_manager = LoginManager()
login_manager.init_app(app)
+login_manager.login_message = u"Bitte einloggen!"
class User (model.User, UserMixin):
def check_password(self, pwd):
diff --git a/app/views/__init__.py b/app/views/__init__.py
index 58d9fb6..275a6c9 100644
--- a/app/views/__init__.py
+++ b/app/views/__init__.py
@@ -9,12 +9,13 @@ from .. import app, db
from ..login import current_user, login_required
from ..utils import templated, redirect
from ..flask_extend import Blueprint
+from flask import flash
__all__ = [
"db", "app",
"current_user", "login_required",
"templated", "redirect",
- "Blueprint",
+ "Blueprint", "flash",
"request", "url_for"
]
diff --git a/app/views/login.py b/app/views/login.py
index 4b327ec..413d406 100644
--- a/app/views/login.py
+++ b/app/views/login.py
@@ -1,4 +1,4 @@
-from . import Blueprint, db, \
+from . import Blueprint, flash, db, \
current_user, login_required, \
templated, request, url_for
@@ -18,6 +18,8 @@ def login():
if form.validate_on_submit():
login_user(form.user)
return redirect(request.args.get("next") or url_for("index"))
+ elif form.is_submitted():
+ flash("Login fehlgeschlagen!", "error")
return { 'form': form }
diff --git a/static/css/style.css b/static/css/style.css
index 4a24733..6463fb4 100644
--- a/static/css/style.css
+++ b/static/css/style.css
@@ -239,6 +239,25 @@ div.month_exp {
/* Post */
+#messages {
+ list-style-type: none;
+ padding: 0;
+ margin: 0;
+}
+
+#messages > li {
+ background: #9e9e9e;
+ color: #000;
+ padding: 5px;
+ margin: 5px 5px 15px 5px;
+ text-align: center;
+ box-shadow: 0 0 6px #888;
+}
+
+#messages > li.msg-error {
+ background: #DA6F6F;
+}
+
.content {
float: left;
width: 710px;
diff --git a/templates/layout.jinja b/templates/layout.jinja
index 77c383d..ab5b001 100644
--- a/templates/layout.jinja
+++ b/templates/layout.jinja
@@ -33,6 +33,15 @@
<div id="page">
<div class="content">
+ {% with messages = get_flashed_messages(with_categories=true) %}
+ {% if messages %}
+ <ul id="messages">
+ {% for cat,msg in messages %}
+ <li class="msg-{{ cat }}">{{ msg }}</li>
+ {% endfor %}
+ </ul>
+ {% endif %}
+ {% endwith %}
<h1 class="page_heading">{% block heading -%}{%- endblock %}</h1>
{% block content %}{% endblock %}
</div>