2016-05-20 16:41:42 -04:30
{% extends "hosting/base_short.html" %}
{% load staticfiles bootstrap3 %}
{% block content %}
< div >
< div class = "container virtual-machine-container dashboard-container " >
< div class = "row" >
< div class = "col-md-9 col-md-offset-2" >
< div class = "col-sm-12" >
2016-05-24 01:19:49 -05:00
2016-07-18 21:24:44 -05:00
< h3 > < i class = "fa fa-key" aria-hidden = "true" > < / i > {% trans "SSH Private Key"%} < / h3 >
2016-05-20 16:41:42 -04:30
< hr / >
2016-05-24 01:19:49 -05:00
{% if private_key %}
< div class = "alert alert-warning" >
2016-07-18 21:24:44 -05:00
< strong > {% trans "Warning!"%}< / strong > {% trans "You can view your SSH private key once. Copy it or if it wasn't downloaded automatically, just click on Download to start it."%}
2016-05-24 01:19:49 -05:00
< / div >
2016-05-20 16:41:42 -04:30
< div class = "form-group" >
< label for = "comment" > private_key.pem< / label >
2016-05-24 01:19:49 -05:00
< textarea class = "form-control" rows = "6" id = "ssh_key" > {{private_key}}< / textarea >
2016-05-20 16:41:42 -04:30
< / div >
2016-05-24 01:19:49 -05:00
< div class = "form-group pull-right" >
< button type = "button" id = "copy_to_clipboard" data-clipboard-target = "#ssh_key" class = "btn btn-warning"
2016-07-18 21:24:44 -05:00
data-toggle="tooltip" data-placement="bottom" title="Copied" data-trigger="click">{% trans "Copy to Clipboard"%}< / button >
< button type = "button" id = "download_ssh_key" class = "btn btn-warning" > {% trans "Download"%}< / button >
2016-05-24 01:19:49 -05:00
< / div >
{% else %}
< div class = "alert alert-warning" >
2016-07-18 21:24:44 -05:00
< strong > {% trans "Warning!"%}< / strong > {% trans "Your SSH private key was already generated and downloaded, if you lost it, contact us. "%}
2016-05-24 01:19:49 -05:00
< / div >
{% endif %}
2016-07-18 21:24:44 -05:00
< a class = "btn btn-success" href = "{% url 'hosting:virtual_machines' virtual_machine.id %}" > {% trans "Go to my Virtual Machine Dashboard"%} < / a >
2016-05-24 01:19:49 -05:00
< div class = "clearfix" > < / div >
2016-05-20 16:41:42 -04:30
< / div >
< / div >
< / div >
< / div >
< / div >
2016-05-24 01:19:49 -05:00
{% if private_key %}
<!-- Force to download ssh key on page load -->
2016-05-20 16:41:42 -04:30
< script type = "text/javascript" >
2016-05-24 01:19:49 -05:00
var key = window.document.getElementById('ssh_key');
var a = window.document.createElement('a');
a.href = window.URL.createObjectURL(new Blob(['key'], {type: 'text'}));
a.download = 'private_key.pem';
// Append anchor to body.
document.body.appendChild(a);
a.click();
// Remove anchor from body
document.body.removeChild(a);
2016-05-20 16:41:42 -04:30
< / script >
2016-05-24 01:19:49 -05:00
{%endif%}
2016-05-20 16:41:42 -04:30
{%endblock%}