mirror of https://github.com/jumpserver/jumpserver
Merge pull request #81 from jumpserver/v3.0_beta_issue_62
V3.0 beta issue 62 用户下载key后,就删除,为了安全pull/94/head
commit
d0ba0503e5
|
@ -452,7 +452,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:
|
||||
|
@ -465,6 +464,8 @@ 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