1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-11-08 21:21:06 +00:00

Add login_context_processor

This commit is contained in:
Mo 2022-11-10 13:20:18 +01:00
parent 6a40098922
commit ce7653186a

View file

@ -2,7 +2,7 @@ from flask import Blueprint, redirect, url_for
from flask_login import current_user from flask_login import current_user
from flask_security.decorators import auth_required from flask_security.decorators import auth_required
from . import settings from . import settings, security
from .model_dependent_funs import active_semester_str from .model_dependent_funs import active_semester_str
bp = Blueprint("main", __name__, root_path="/", template_folder="templates") bp = Blueprint("main", __name__, root_path="/", template_folder="templates")
@ -18,6 +18,11 @@ def util_processor():
return dict(active_semester_str=active_semester_str, current_user=current_user, footer=footer) return dict(active_semester_str=active_semester_str, current_user=current_user, footer=footer)
@security.login_context_processor
def login_context_processor():
return dict(message=settings.get("login_view_message"))
@bp.route("/") @bp.route("/")
def index(): def index():
if current_user.has_role("admin"): if current_user.has_role("admin"):