diff --git a/umap/context_processors.py b/umap/context_processors.py index 26c1c0f0..c6bdf6dc 100644 --- a/umap/context_processors.py +++ b/umap/context_processors.py @@ -14,3 +14,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 a308f2c0..a72d9f45 100644 --- a/umap/settings/base.py +++ b/umap/settings/base.py @@ -119,6 +119,7 @@ TEMPLATES = [ 'social.apps.django_app.context_processors.login_redirect', 'umap.context_processors.settings', 'umap.context_processors.version', + 'umap.context_processors.authentication', ) } }, @@ -142,6 +143,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 ec5e208d..c74756fa 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 eb5b8783..49bb6432 100644 --- a/umap/templates/registration/login.html +++ b/umap/templates/registration/login.html @@ -1,5 +1,27 @@ {% load i18n %} +{% if ENABLE_ACCOUNT_LOGIN %} +
{% trans "Please enter your old password, for security's sake, and then enter your new password twice so we can verify you typed it in correctly." %}
+ + +{% endblock content %} diff --git a/umap/templates/umap/password_change_done.html b/umap/templates/umap/password_change_done.html new file mode 100644 index 00000000..039e6121 --- /dev/null +++ b/umap/templates/umap/password_change_done.html @@ -0,0 +1,9 @@ +{% extends "umap/content.html" %} + +{% load leaflet_storage_tags i18n %} + +{% block content %} +{% trans "Your password was changed." %}
+ +{% endblock content %} diff --git a/umap/urls.py b/umap/urls.py index e41bac2f..322c124f 100644 --- a/umap/urls.py +++ b/umap/urls.py @@ -5,6 +5,7 @@ from django.conf.urls import url, include from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.contrib import admin from django.views.decorators.cache import cache_page +from django.contrib.auth import views as auth_views from leaflet_storage.views import MapShortUrl @@ -18,6 +19,12 @@ urlpatterns = [ url(r'^m/(?P