From 6e5e10594c06446b9eed47aeb9c4ab0b27176611 Mon Sep 17 00:00:00 2001 From: "Ing. Jan KRCMAR" Date: Mon, 7 May 2018 10:51:23 +0200 Subject: [PATCH] SHOW_PROFILE_EDIT_PASSWORD, SHOW_ACCESS_ROOT_PASSWORD, SHOW_ACCESS_SSH_KEYS in settings.py are not inherited in templates. they are now forwarded directly into views. --- accounts/templates/profile.html | 2 +- accounts/views.py | 1 + instances/templates/instance.html | 8 ++++---- instances/views.py | 3 +++ 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/accounts/templates/profile.html b/accounts/templates/profile.html index b8c7b1c..d2213b4 100644 --- a/accounts/templates/profile.html +++ b/accounts/templates/profile.html @@ -41,7 +41,7 @@ - {% if SHOW_PROFILE_EDIT_PASSWORD %} + {% if show_profile_edit_password %}
{% csrf_token %}
diff --git a/accounts/views.py b/accounts/views.py index af405e0..5fdfb4d 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -20,6 +20,7 @@ def profile(request): error_messages = [] user = User.objects.get(id=request.user.id) publickeys = UserSSHKey.objects.filter(user_id=request.user.id) + show_profile_edit_password = settings.SHOW_PROFILE_EDIT_PASSWORD if request.method == 'POST': if 'username' in request.POST: diff --git a/instances/templates/instance.html b/instances/templates/instance.html index f548b02..2b73c0a 100644 --- a/instances/templates/instance.html +++ b/instances/templates/instance.html @@ -227,14 +227,14 @@ {% trans "Console" %} - {% if SHOW_ACCESS_ROOT_PASSWORD %} + {% if show_access_root_password %}
  • {% trans "Root Password" %}
  • {% endif %} - {% if SHOW_ACCESS_SSH_KEYS %} + {% if show_access_ssh_keys %}
  • {% trans "SSH Keys" %} @@ -253,7 +253,7 @@ {% endifequal %}
  • - {% if SHOW_ACCESS_ROOT_PASSWORD %} + {% if show_access_root_password %}

    {% trans "You need shut down your instance and enter a new root password." %}

    {% csrf_token %} @@ -271,7 +271,7 @@
    {% endif %} - {% if SHOW_ACCESS_SSH_KEYS %} + {% if show_access_ssh_keys %}

    {% trans "You need shut down your instance and choose your public key." %}

    {% csrf_token %} diff --git a/instances/views.py b/instances/views.py index cd8143e..0d6dfab 100644 --- a/instances/views.py +++ b/instances/views.py @@ -344,6 +344,9 @@ def instance(request, compute_id, vname): formats = conn.get_image_formats() default_bus = settings.INSTANCE_VOLUME_DEFAULT_BUS busses = conn.get_busses() + default_bus = settings.INSTANCE_VOLUME_DEFAULT_BUS + show_access_root_password = settings.SHOW_ACCESS_ROOT_PASSWORD + show_access_ssh_keys = settings.SHOW_ACCESS_SSH_KEYS try: instance = Instance.objects.get(compute_id=compute_id, name=vname)