diff options
-rw-r--r-- | accounts/__init__.py | 1 | ||||
-rw-r--r-- | accounts/templates/base.html | 4 | ||||
-rw-r--r-- | accounts/views/admin/__init__.py | 2 |
3 files changed, 2 insertions, 5 deletions
diff --git a/accounts/__init__.py b/accounts/__init__.py index 964d013..7d3105b 100644 --- a/accounts/__init__.py +++ b/accounts/__init__.py @@ -27,6 +27,7 @@ if app.config.get('USERNAME_BLACKLIST_FILE'): login_manager = LoginManager() login_manager.init_app(app) +login_manager.login_view = 'default.login' @login_manager.user_loader def load_user(user_id): diff --git a/accounts/templates/base.html b/accounts/templates/base.html index b97c5ed..084e747 100644 --- a/accounts/templates/base.html +++ b/accounts/templates/base.html @@ -16,11 +16,7 @@ <div id="header-background"> </div> <header> <h1> - {%- if current_user.is_authenticated -%} <a href="{{ url_for('default.index') }}"> - {%- else -%} - <a href="{{ url_for('default.login') }}"> - {%- endif -%} <img src="{{ url_for('static', filename='logo.png') }}" alt="spline accounts" /> </a> </h1> diff --git a/accounts/views/admin/__init__.py b/accounts/views/admin/__init__.py index be7f3d7..be90e7f 100644 --- a/accounts/views/admin/__init__.py +++ b/accounts/views/admin/__init__.py @@ -17,7 +17,7 @@ bp = Blueprint('admin', __name__) @bp.before_request def restrict_bp_to_admins(): if not current_user.is_authenticated: - raise Forbidden(u'Bitte einloggen!') + return current_app.login_manager.unauthorized() if current_user.uid not in current_app.config.get('ADMIN_USERS', []): raise Forbidden(u'Du bist kein Admin.') |