Skip to content
Snippets Groups Projects
Commit 918a24a2 authored by davidc's avatar davidc Committed by Julian
Browse files

Config option DEFAULT_PAGE_SERVICES to allow 'services' to be the default page

parent 081c7a19
No related branches found
No related tags found
No related merge requests found
...@@ -68,7 +68,11 @@ def create_app(test_config=None): # pylint: disable=too-many-locals,too-many-sta ...@@ -68,7 +68,11 @@ def create_app(test_config=None): # pylint: disable=too-many-locals,too-many-sta
register_template_helper(app) register_template_helper(app)
# Sort the navbar positions by their blueprint names (from the left) # 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) setup_navbar(app, positions)
# We never want to fail here, but at a file access that doesn't work. # 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 ...@@ -100,6 +104,8 @@ def create_app(test_config=None): # pylint: disable=too-many-locals,too-many-sta
@app.route("/") @app.route("/")
def index(): #pylint: disable=unused-variable def index(): #pylint: disable=unused-variable
if app.config['DEFAULT_PAGE_SERVICES']:
return redirect(url_for('service.overview'))
return redirect(url_for('selfservice.index')) return redirect(url_for('selfservice.index'))
@app.route('/lang', methods=['POST']) @app.route('/lang', methods=['POST'])
......
...@@ -51,6 +51,10 @@ SQLALCHEMY_TRACK_MODIFICATIONS=False ...@@ -51,6 +51,10 @@ SQLALCHEMY_TRACK_MODIFICATIONS=False
FOOTER_LINKS=[{"url": "https://example.com", "title": "example"}] 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) # Service overview page (disabled if empty)
SERVICES=[ SERVICES=[
# # Title is mandatory, all other fields are optional. # # Title is mandatory, all other fields are optional.
......
...@@ -5,7 +5,18 @@ ...@@ -5,7 +5,18 @@
{% set iconstyle = 'style="width: 1.8em;"'|safe %} {% set iconstyle = 'style="width: 1.8em;"'|safe %}
{% if not request.user %} {% 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 %} {% endif %}
{% if banner %} {% if banner %}
......
...@@ -20,7 +20,7 @@ def signup_enabled(func): ...@@ -20,7 +20,7 @@ def signup_enabled(func):
@functools.wraps(func) @functools.wraps(func)
def decorator(*args, **kwargs): def decorator(*args, **kwargs):
if not current_app.config['SELF_SIGNUP']: if not current_app.config['SELF_SIGNUP']:
flash(_('Singup not enabled')) flash(_('Signup not enabled'))
return redirect(url_for('index')) return redirect(url_for('index'))
return func(*args, **kwargs) return func(*args, **kwargs)
return decorator return decorator
...@@ -104,4 +104,4 @@ def signup_confirm_submit(signup_id, token): ...@@ -104,4 +104,4 @@ def signup_confirm_submit(signup_id, token):
db.session.commit() db.session.commit()
set_session(user, skip_mfa=True) set_session(user, skip_mfa=True)
flash(_('Your account was successfully created')) flash(_('Your account was successfully created'))
return redirect(url_for('selfservice.index')) return redirect(url_for('index'))
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
<nav class="navbar navbar-expand-md navbar-dark bg-dark static-top" > <nav class="navbar navbar-expand-md navbar-dark bg-dark static-top" >
<a class="navbar-brand" href="{{ url_for('index') }}">{{ config['SITE_TITLE'] }}</a> <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"> <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> <span class="navbar-toggler-icon"></span>
</button> </button>
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
</ul> </ul>
{% endif %} {% 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"> <ul class="navbar-nav ml-auto">
{% if config['LANGUAGES']|length > 1 %} {% if config['LANGUAGES']|length > 1 %}
<li class="nav-item"> <li class="nav-item">
...@@ -99,6 +99,13 @@ ...@@ -99,6 +99,13 @@
{{_("Logout")}} {{_("Logout")}}
</a> </a>
</li> </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 %} {% endif %}
</ul> </ul>
{% endif %} {% endif %}
......
No preview for this file type
...@@ -1420,7 +1420,7 @@ msgid "Forgot Password?" ...@@ -1420,7 +1420,7 @@ msgid "Forgot Password?"
msgstr "Passwort vergessen?" msgstr "Passwort vergessen?"
#: uffd/signup/views.py:23 #: uffd/signup/views.py:23
msgid "Singup not enabled" msgid "Signup not enabled"
msgstr "Account-Registrierung ist deaktiviert" msgstr "Account-Registrierung ist deaktiviert"
#: uffd/signup/views.py:81 uffd/signup/views.py:89 #: uffd/signup/views.py:81 uffd/signup/views.py:89
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment