diff --git a/uffd/__init__.py b/uffd/__init__.py index 8831fbdb73820e87cc14df91a8fa06bb89de1e5d..f9a0df33e96e06dab6102eba856d039e4c136b25 100644 --- a/uffd/__init__.py +++ b/uffd/__init__.py @@ -68,7 +68,11 @@ def create_app(test_config=None): # pylint: disable=too-many-locals,too-many-sta register_template_helper(app) # Sort the navbar positions by their blueprint names (from the left) - positions = ["selfservice", "service", "rolemod", "invite", "user", "group", "role", "mail"] + if app.config['DEFAULT_PAGE_SERVICES']: + positions = ["service", "selfservice"] + else: + positions = ["selfservice", "service"] + positions += ["rolemod", "invite", "user", "group", "role", "mail"] setup_navbar(app, positions) # We never want to fail here, but at a file access that doesn't work. @@ -100,6 +104,8 @@ def create_app(test_config=None): # pylint: disable=too-many-locals,too-many-sta @app.route("/") def index(): #pylint: disable=unused-variable + if app.config['DEFAULT_PAGE_SERVICES']: + return redirect(url_for('service.overview')) return redirect(url_for('selfservice.index')) @app.route('/lang', methods=['POST']) diff --git a/uffd/default_config.cfg b/uffd/default_config.cfg index 6ce182f9073284d6e0681147ed7f97aff6c86df7..14e1cdf34e6c890ae803e16f1a8c4cc6e1ca39f5 100644 --- a/uffd/default_config.cfg +++ b/uffd/default_config.cfg @@ -51,6 +51,10 @@ SQLALCHEMY_TRACK_MODIFICATIONS=False FOOTER_LINKS=[{"url": "https://example.com", "title": "example"}] +# The default page after login or clicking the top left home button is the self-service +# page. If you would like it to be the services list instead, set this to True. +DEFAULT_PAGE_SERVICES=False + # Service overview page (disabled if empty) SERVICES=[ # # Title is mandatory, all other fields are optional. diff --git a/uffd/service/templates/service/overview.html b/uffd/service/templates/service/overview.html index 5ed19e388cc4e0b17d4655b1cfcb4305a33ff06b..976cad59ab4a668acee018ae92150a4890c61677 100644 --- a/uffd/service/templates/service/overview.html +++ b/uffd/service/templates/service/overview.html @@ -5,7 +5,18 @@ {% set iconstyle = 'style="width: 1.8em;"'|safe %} {% if not request.user %} -<div class="alert alert-warning" role="alert">{{_("Some services may not be publicly listed! Log in to see all services you have access to.")}}</div> +<div class="alert alert-warning" role="alert"> + <div class="row"> + <div class="col-12 col-md-9 col-lg-10 col-xl-10"> + {{ _("Some services may not be publicly listed! Log in to see all services you have access to.") }} + </div> + <div class="col-12 col-md-3 col-lg-2 col-xl-2 text-center text-md-right text-lg-right text-xl-right"> + <a class="btn btn-primary" href="{{ url_for("session.login", ref=request.full_path) }}"> + <i class="fa fa-sign-in-alt" aria-hidden="true"></i> {{ _("Login") }} + </a> + </div> + </div> +</div> {% endif %} {% if banner %} diff --git a/uffd/signup/views.py b/uffd/signup/views.py index 45d38b921819e4835ac3af24498e1315a75830bf..f0d858ec88703254b20dc70405133d15c291b405 100644 --- a/uffd/signup/views.py +++ b/uffd/signup/views.py @@ -20,7 +20,7 @@ def signup_enabled(func): @functools.wraps(func) def decorator(*args, **kwargs): if not current_app.config['SELF_SIGNUP']: - flash(_('Singup not enabled')) + flash(_('Signup not enabled')) return redirect(url_for('index')) return func(*args, **kwargs) return decorator @@ -104,4 +104,4 @@ def signup_confirm_submit(signup_id, token): db.session.commit() set_session(user, skip_mfa=True) flash(_('Your account was successfully created')) - return redirect(url_for('selfservice.index')) + return redirect(url_for('index')) diff --git a/uffd/templates/base.html b/uffd/templates/base.html index 2d75ed3bc17a7ff1483e39dd2de09f64c58fb3e3..972e84f78bbae1e34c4be4eb2e3325056bdd8913 100644 --- a/uffd/templates/base.html +++ b/uffd/templates/base.html @@ -36,7 +36,7 @@ <nav class="navbar navbar-expand-md navbar-dark bg-dark static-top" > <a class="navbar-brand" href="{{ url_for('index') }}">{{ config['SITE_TITLE'] }}</a> - {% if getnavbar() or request.user or config['LANGUAGES']|length > 1 %} + {% if getnavbar() or request.user or request.endpoint != 'session.login' or config['LANGUAGES']|length > 1 %} <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#baseNavbar" aria-controls="baseNavbar" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> @@ -69,7 +69,7 @@ </ul> {% endif %} - {% if request.user or config['LANGUAGES']|length > 1 %} + {% if request.user or request.endpoint != 'session.login' or config['LANGUAGES']|length > 1 %} <ul class="navbar-nav ml-auto"> {% if config['LANGUAGES']|length > 1 %} <li class="nav-item"> @@ -99,6 +99,13 @@ {{_("Logout")}} </a> </li> + {% elif request.endpoint != 'session.login' %} + <li class="nav-item"> + <a class="nav-link" href="{{ url_for("session.login", ref=request.full_path) }}"> + <span aria-hidden="true" class="fa fa-sign-in-alt"></span> + {{ _("Login") }} + </a> + </li> {% endif %} </ul> {% endif %} diff --git a/uffd/translations/de/LC_MESSAGES/messages.mo b/uffd/translations/de/LC_MESSAGES/messages.mo index 023a8ff198467f132f0bee4dfd9fee746756c628..837caf0baecd3654d28ed65210d9f6a8a1ea2098 100644 Binary files a/uffd/translations/de/LC_MESSAGES/messages.mo and b/uffd/translations/de/LC_MESSAGES/messages.mo differ diff --git a/uffd/translations/de/LC_MESSAGES/messages.po b/uffd/translations/de/LC_MESSAGES/messages.po index 947c7072e46e89883c046988f722366c252de5d4..1433cc6c46cc3e4a39e737489eeafe84769960cd 100644 --- a/uffd/translations/de/LC_MESSAGES/messages.po +++ b/uffd/translations/de/LC_MESSAGES/messages.po @@ -1420,7 +1420,7 @@ msgid "Forgot Password?" msgstr "Passwort vergessen?" #: uffd/signup/views.py:23 -msgid "Singup not enabled" +msgid "Signup not enabled" msgstr "Account-Registrierung ist deaktiviert" #: uffd/signup/views.py:81 uffd/signup/views.py:89