Stop flashing 'Please log in to access this page.'

This message was "flashed" (http://flask.pocoo.org/docs/0.12/patterns/flashing/)
by Flask-Login. This happens on every unauthorised request, so also on
AJAX requests (like for the notifications). As a result, a user could be
spammed by a screen full of these messages if they left their window open
and their session timed out.
This commit is contained in:
Sybren A. Stüvel 2017-05-05 10:40:08 +02:00
parent 379d40837b
commit 870800e8d2

View File

@ -71,6 +71,7 @@ def config_login_manager(app):
login_manager = flask_login.LoginManager()
login_manager.init_app(app)
login_manager.login_view = "users.login"
login_manager.login_message = ''
login_manager.anonymous_user = AnonymousUser
# noinspection PyTypeChecker
login_manager.user_loader(_load_user)