From 6caeeefbce30b3d3d37464fd39dc5b6962b81cd2 Mon Sep 17 00:00:00 2001 From: Greg Linch Date: Thu, 14 May 2020 16:09:23 -0400 Subject: [PATCH 1/2] remove credits atop the readme that are no longer relevant since we moved to docker container --- readme.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/readme.md b/readme.md index 0df70ad..912077c 100755 --- a/readme.md +++ b/readme.md @@ -1,9 +1,5 @@ This is an open-source tool for creating a database of sources. -(hat tip to Digital Ocean [Django](https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-uwsgi-and-nginx-on-ubuntu-16-04) and [Postgres](https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04)) - -https://docs.bitnami.com/google/infrastructure/django/get-started/start-django-project/ - # Developer Setup The following instructions are intended for a developer to set this up locally From 5c67d214a5aee5f204f11f526dff6848e2aa0805 Mon Sep 17 00:00:00 2001 From: Greg Linch Date: Fri, 15 May 2020 11:29:46 -0400 Subject: [PATCH 2/2] re-enable password login for test environments only --- sourcedive/settings.py | 1 + sources/context_processors.py | 8 ++++++++ templates/admin/base.html | 3 +++ templates/admin/login.html | 27 +++++++++++++++++++++++++++ 4 files changed, 39 insertions(+) create mode 100644 sources/context_processors.py diff --git a/sourcedive/settings.py b/sourcedive/settings.py index 4b56ecc..38e8e3d 100755 --- a/sourcedive/settings.py +++ b/sourcedive/settings.py @@ -61,6 +61,7 @@ 'django.contrib.messages.context_processors.messages', 'social_django.context_processors.backends', 'social_django.context_processors.login_redirect', + 'sources.context_processors.sources_context_processor' ], }, }, diff --git a/sources/context_processors.py b/sources/context_processors.py new file mode 100644 index 0000000..1b511f6 --- /dev/null +++ b/sources/context_processors.py @@ -0,0 +1,8 @@ +from django.conf import settings + + +def sources_context_processor(request): + context = {} + context['test_env'] = settings.TEST_ENV + + return context diff --git a/templates/admin/base.html b/templates/admin/base.html index 69bd05e..057dbab 100644 --- a/templates/admin/base.html +++ b/templates/admin/base.html @@ -15,6 +15,9 @@ {% trans 'Documentation' %} / {% endif %} {% endif %} + {% if user.has_usable_password and test_env %} + Change password / + {% endif %} {% trans 'Log out' %} {% endblock %} diff --git a/templates/admin/login.html b/templates/admin/login.html index d36512f..d4a7636 100755 --- a/templates/admin/login.html +++ b/templates/admin/login.html @@ -55,6 +55,33 @@
Log in with Gmail
+ {% if test_env %} +
+
+
+ +
{% csrf_token %} +
+ {{ form.username.errors }} + {{ form.username.label_tag }} {{ form.username }} +
+
+ {{ form.password.errors }} + {{ form.password.label_tag }} {{ form.password }} + +
+ {% url 'admin_password_reset' as password_reset_url %} + {% if password_reset_url %} + + {% endif %} +
+ +
+ {% endif %}
{% endblock %}