From fdca3cef9c0c52fc40d87558ea5f2bb82f2425af Mon Sep 17 00:00:00 2001 From: "Ing. Jan KRCMAR" <honza801@civ.zcu.cz> Date: Wed, 15 Nov 2017 12:55:05 +0100 Subject: [PATCH] account view now displays user public keys --- accounts/templates/account.html | 25 ++++++++++++++++++++++++- accounts/views.py | 1 + 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/accounts/templates/account.html b/accounts/templates/account.html index c8d8c19..9da2c3e 100644 --- a/accounts/templates/account.html +++ b/accounts/templates/account.html @@ -13,6 +13,29 @@ {% include 'errors_block.html' %} + {% if request.user.is_superuser and publickeys %} + <div class="row"> + <div class="col-lg-12"> + <div class="table-responsive"> + <table class="table table-bordered table-hover"> + <thead> + <tr> + <th>{% trans "Key name" %}</th> + <th>{% trans "Public key" %}</th> + </tr> + </thead> + <tbody> + {% for publickey in publickeys %} + <td>{{ publickey.keyname }}</td> + <td title="{{ publickey.keypublic }}">{{ publickey.keypublic|truncatechars:64 }}</td> + {% endfor %} + </tbody> + </table> + </div> + </div> + </div> + {% endif %} + <div class="row"> <div class="col-lg-12"> {% if not user_insts %} @@ -112,4 +135,4 @@ {% endif %} </div> </div> -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/accounts/views.py b/accounts/views.py index 6e9fd52..af405e0 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -146,6 +146,7 @@ def account(request, user_id): user = User.objects.get(id=user_id) user_insts = UserInstance.objects.filter(user_id=user_id) instances = Instance.objects.all().order_by('name') + publickeys = UserSSHKey.objects.filter(user_id=user_id) if request.method == 'POST': if 'delete' in request.POST: