{% extends "admin/base_site.html" %}
{% load i18n %}
{% load translations %}

{% block title %}{% trans "SSH keys" %}{% endblock %}

{% block breadcrumbs %}
<div class="breadcrumbs"><a href="../">
{% trans "Home" %}</a> &rsaquo; {% trans "SSH keys" %}
</div>{% endblock %}

{% block content %}
<div id="content-main">
  <h1>{% trans "SSH keys management" %}</h1>
  <ul class="object-tools">
    <li>
        <a href="{% documentation 'admin/projects' 'private' %}" class="doclink">{% trans "Documentation" %}</a>
    </li>
  </ul>
  <div class="module">

    {% if public_key %}
    <h2>{% trans "Public SSH key" %}</h2>
    <p>{% trans "Weblate currently uses following SSH key:" %}</p>
    <form>
    <textarea style="width:100%" readonly="readonly">{{ public_key.key }}</textarea>
    </form>


    {% elif can_generate %}
    <h2>{% trans "Generate SSH key" %}</h2>
    <p>{% trans "You don't seem to have existing SSH key, by pressing button below Weblate will generate it for you." %}</p>
    <form method="post">
    {% csrf_token %}
    <input type="hidden" name="action" value="generate" />
    <input type="submit" value="{% trans "Generate" %}" />
    </form>

    {% endif %}

    {% if host_keys %}
    <h2>{% trans "Known host keys" %}</h2>

  <div id="changelist" class="module filtered">
    <div class="results">
  <table id="result_list">
  <thead>
  <tr>
    <th>{% trans "Hostname" %}</th>
    <th>{% trans "Key type" %}</th>
    <th>{% trans "Fingerprint" %}</th>
  </tr>
  </thead>
  <tbody>
    {% for key in host_keys %}
    <tr class="row{% cycle '1' '2' %}"><td>{{ key.0 }}</td><td>{{ key.1 }}</td><td>{{ key.2 }}</td></tr>
    {% endfor %}
  </tbody>
    </table>
</div>
</div>
    {% endif %}

    <h2>{% trans "Add host key" %}</h2>
    <p>{% trans "To access SSH hosts, its host key needs to be verified. You can get the host key by entering a domain name or IP for the host in the form below." %}</p>
    <form method="post">
    {% csrf_token %}
    <input type="hidden" name="action" value="add-host" />
    {% trans "Host:" %}
    <input type="text" name="host" />
    {% trans "Port:" %}
    <input type="text" name="port" /><br />
    <input type="submit" value="{% trans "Submit" %}" />
    </form>

  </div>
</div>
{% endblock %}
