mirror of https://github.com/jumpserver/jumpserver
fix(user_list.html & juser/views.py): only for user delete sshkey when downloaded, add generate butt
https://github.com/jumpserver/jumpserver/issues/62pull/81/head
parent
a037108cf3
commit
27be35ae77
|
@ -453,7 +453,6 @@ def down_key(request):
|
|||
uuid_r = request.GET.get('uuid', '')
|
||||
else:
|
||||
uuid_r = request.user.uuid
|
||||
|
||||
if uuid_r:
|
||||
user = get_object(User, uuid=uuid_r)
|
||||
if user:
|
||||
|
@ -466,6 +465,7 @@ def down_key(request):
|
|||
f.close()
|
||||
response = HttpResponse(data, content_type='application/octet-stream')
|
||||
response['Content-Disposition'] = 'attachment; filename=%s' % os.path.basename(private_key_file)
|
||||
if request.user.role == 'CU':
|
||||
os.unlink(private_key_file)
|
||||
return response
|
||||
return HttpResponse('No Key File. Contact Admin.')
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
{% if user.username|key_exist %}
|
||||
<a href="{% url 'key_down' %}?uuid={{ user.uuid }}" >下载</a>
|
||||
{% else %}
|
||||
<span style="color: #586b7d">NoKey</span>
|
||||
<a href="#" onclick="genSSH('{{ user.username }}','{% url 'key_gen' %}?uuid={{ user.uuid }}')">NoKey GenOne?</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="text-center">
|
||||
|
@ -150,5 +150,13 @@
|
|||
});
|
||||
$('.shiftCheckbox').shiftcheckbox();
|
||||
});
|
||||
function genSSH(username, url) {
|
||||
if (confirm('Are you sure to gen a sshkey for user ' + username)) {
|
||||
$.get(url, function (data) {
|
||||
alert(data);
|
||||
location.reload()
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
Loading…
Reference in New Issue