{% extends "admin/settings.html" %}
{% load djblets_utils i18n %}

{% block form_content %}
<fieldset class="module aligned">
 <div class="description">
  <p>
  {% blocktrans %}
   The SSH key configured here will be used for communication with any
   SSH-backend repositories.
  {% endblocktrans %}
  </p>
 </div>
</fieldset>
{% if key %}
<fieldset class="module aligned">
 <div class="form-row">
  <label class="required">{% trans "Key type:" %}</label>
  {{key.get_name}}
 </div>
 <div class="form-row">
  <label class="required">{% trans "Bits:" %}</label>
  {{key.get_bits}}
 </div>
 <div class="form-row">
  <label class="required">{% trans "Fingerprint:" %}</label>
  <code>{{fingerprint}}</code>
 </div>
 <div class="form-row">
  <label class="required">{% trans "Public key:" %}</label>
  <textarea cols="65" rows="10" readonly="readonly" class="public-key">{{key.get_name}} {{public_key}}</textarea>
 </div>
 <div class="form-row">
  <label></label>
  <form method="POST" action=".">
   {% csrf_token %}
   {{form.delete_key}}
   <input type="submit" value="{% trans "Delete Key" %}" />
  </form>
 </div>
</fieldset>
{% else %}
<fieldset class="module aligned">
 <div class="form-row">
  <h3>{% trans "Generate an SSH Key" %}</h3>
  <p>
  {% blocktrans %}
   You can generate a brand new RSA key specific to this installation of
   Review Board.
  {% endblocktrans %}
  </p>
  <p>
  {% blocktrans %}
   Note that generating a key may take some time. Don't click more than once.
  {% endblocktrans %}
  </p>
  <form method="POST" action=".">
   {% csrf_token %}
   {{form.generate_key}}
   <input type="submit" value="{% trans "Generate Key" %}" />
  </form>

  <h3>{% trans "Upload an SSH Key" %}</h3>
  <p>
  {% blocktrans %}
   If you already have an SSH key (<code>id_dsa</code> or <code>id_rsa</code>
   file) you want to use, you can upload it. Note that this key will be
   readable by the web server, so provide one you feel safe using.
  {% endblocktrans %}
  </p>
  <form method="POST" action="." enctype="multipart/form-data">
   {% csrf_token %}
   {{form.keyfile.errors}}
   {{form.keyfile}}<br />
   <input type="submit" value="{% trans "Upload Key" %}" />
  </form>
 </div>
</fieldset>
{% endif %}
{% endblock %}
