From 5f63943458b1a75d8f5307d8e2b8a3e0bd414b2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20B=C3=B6sch-Plepelits?= Date: Wed, 3 Feb 2016 21:58:55 +0100 Subject: [PATCH] Authentication: configure availability of account login (default True) --- umap/context_processors.py | 5 +++++ umap/settings/base.py | 2 ++ umap/settings/local.py.sample | 4 ++++ umap/templates/registration/login.html | 2 +- 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/umap/context_processors.py b/umap/context_processors.py index 00d72b7f..3b0944a0 100644 --- a/umap/context_processors.py +++ b/umap/context_processors.py @@ -11,3 +11,8 @@ def version(request): return { 'UMAP_VERSION': __version__ } + +def authentication(request): + return { + 'ENABLE_ACCOUNT_LOGIN': settings.ENABLE_ACCOUNT_LOGIN + } diff --git a/umap/settings/base.py b/umap/settings/base.py index 2bc90cc2..89fc0757 100644 --- a/umap/settings/base.py +++ b/umap/settings/base.py @@ -110,6 +110,7 @@ TEMPLATE_CONTEXT_PROCESSORS += ( 'social.apps.django_app.context_processors.login_redirect', 'umap.context_processors.feedback_link', 'umap.context_processors.version', + 'umap.context_processors.authentication', ) TEMPLATE_LOADERS = ( @@ -134,6 +135,7 @@ MIDDLEWARE_CLASSES = ( # Auth / security # ============================================================================= +ENABLE_ACCOUNT_LOGIN = True AUTHENTICATION_BACKENDS += ( ) diff --git a/umap/settings/local.py.sample b/umap/settings/local.py.sample index 0bc52bdf..24d48fb0 100644 --- a/umap/settings/local.py.sample +++ b/umap/settings/local.py.sample @@ -37,6 +37,10 @@ COMPRESS_OFFLINE = True LANGUAGE_CODE = 'en' +# Set to False if login into django account should not be possible. You can +# administer accounts in the admin interface. +ENABLE_ACCOUNT_LOGIN = True + AUTHENTICATION_BACKENDS = ( 'social.backends.github.GithubOAuth2', 'social.backends.bitbucket.BitbucketOAuth', diff --git a/umap/templates/registration/login.html b/umap/templates/registration/login.html index 4281cf38..3fc6dd88 100644 --- a/umap/templates/registration/login.html +++ b/umap/templates/registration/login.html @@ -1,6 +1,6 @@ {% load i18n %} -{% if True %} {# TODO: replace by check, whether local login is enabled #} +{% if ENABLE_ACCOUNT_LOGIN %}
{% trans "Please log in with your account" %}