1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-24 23:25:24 +00:00

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.

This commit is contained in:
Ing. Jan KRCMAR 2018-05-07 10:51:23 +02:00
parent c58374ea2e
commit 6e5e10594c
4 changed files with 9 additions and 5 deletions

View file

@ -41,7 +41,7 @@
</div> </div>
</div> </div>
</form> </form>
{% if SHOW_PROFILE_EDIT_PASSWORD %} {% if show_profile_edit_password %}
<h3 class="page-header">{% trans "Edit Password" %}</h3> <h3 class="page-header">{% trans "Edit Password" %}</h3>
<form class="form-horizontal" method="post" action="" role="form">{% csrf_token %} <form class="form-horizontal" method="post" action="" role="form">{% csrf_token %}
<div class="form-group"> <div class="form-group">

View file

@ -20,6 +20,7 @@ def profile(request):
error_messages = [] error_messages = []
user = User.objects.get(id=request.user.id) user = User.objects.get(id=request.user.id)
publickeys = UserSSHKey.objects.filter(user_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 request.method == 'POST':
if 'username' in request.POST: if 'username' in request.POST:

View file

@ -227,14 +227,14 @@
{% trans "Console" %} {% trans "Console" %}
</a> </a>
</li> </li>
{% if SHOW_ACCESS_ROOT_PASSWORD %} {% if show_access_root_password %}
<li role="presentation"> <li role="presentation">
<a href="#rootpasswd" aria-controls="rootpasswd" role="tab" data-toggle="tab"> <a href="#rootpasswd" aria-controls="rootpasswd" role="tab" data-toggle="tab">
{% trans "Root Password" %} {% trans "Root Password" %}
</a> </a>
</li> </li>
{% endif %} {% endif %}
{% if SHOW_ACCESS_SSH_KEYS %} {% if show_access_ssh_keys %}
<li role="presentation"> <li role="presentation">
<a href="#sshkeys" aria-controls="sshkeys" role="tab" data-toggle="tab"> <a href="#sshkeys" aria-controls="sshkeys" role="tab" data-toggle="tab">
{% trans "SSH Keys" %} {% trans "SSH Keys" %}
@ -253,7 +253,7 @@
{% endifequal %} {% endifequal %}
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
{% if SHOW_ACCESS_ROOT_PASSWORD %} {% if show_access_root_password %}
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="rootpasswd"> <div role="tabpanel" class="tab-pane tab-pane-bordered" id="rootpasswd">
<p>{% trans "You need shut down your instance and enter a new root password." %}</p> <p>{% trans "You need shut down your instance and enter a new root password." %}</p>
<form class="form-inline" method="post" role="form">{% csrf_token %} <form class="form-inline" method="post" role="form">{% csrf_token %}
@ -271,7 +271,7 @@
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
{% endif %} {% endif %}
{% if SHOW_ACCESS_SSH_KEYS %} {% if show_access_ssh_keys %}
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="sshkeys"> <div role="tabpanel" class="tab-pane tab-pane-bordered" id="sshkeys">
<p>{% trans "You need shut down your instance and choose your public key." %}</p> <p>{% trans "You need shut down your instance and choose your public key." %}</p>
<form class="form-inline" method="post" role="form">{% csrf_token %} <form class="form-inline" method="post" role="form">{% csrf_token %}

View file

@ -344,6 +344,9 @@ def instance(request, compute_id, vname):
formats = conn.get_image_formats() formats = conn.get_image_formats()
default_bus = settings.INSTANCE_VOLUME_DEFAULT_BUS default_bus = settings.INSTANCE_VOLUME_DEFAULT_BUS
busses = conn.get_busses() 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: try:
instance = Instance.objects.get(compute_id=compute_id, name=vname) instance = Instance.objects.get(compute_id=compute_id, name=vname)