samjeston / openhub Public
Sam Jeston Working vertical 9aa3c45 · History
63 lines· 3.2 KB ·HTML
Raw
1{% extends "layout_settings.html" %}
2{% block title %}SSH keys · Openhub{% endblock %}
3{% block settings %}
4<section class="settings-section">
5 <h2 class="settings-title">SSH keys</h2>
6 <p class="text-muted">These keys can push to and pull from every repository you have access to. Remove any key you no longer recognise.</p>
7 {% if keys.is_empty() %}
8 <div class="blankslate blankslate-sm box">
9 {{ crate::web::fmt::icon("key-round")|safe }}
10 <h3>No SSH keys yet</h3>
11 <p>Add a key below to start pushing over SSH.</p>
12 </div>
13 {% else %}
14 <div class="box">
15 {% for k in keys %}
16 <div class="box-row key-row">
17 <div class="key-icon">{{ crate::web::fmt::icon("key-round")|safe }}<span class="label">SSH</span></div>
18 <div class="key-main">
19 <strong>{{ k.title }}</strong>
20 <code class="key-fingerprint">{{ k.fingerprint }}</code>
21 <div class="text-muted text-small">
22 {{ k.key_type }} · Added {{ crate::web::fmt::date(k.created_at) }} ·
23 {% if let Some(used) = k.last_used_at %}Last used <time title="{{ crate::web::fmt::datetime_full(used) }}">{{ crate::web::fmt::ago(used) }}</time>{% else %}Never used{% endif %}
24 </div>
25 </div>
26 <form method="post" action="/settings/keys/{{ k.id }}/delete" data-confirm="Delete the SSH key “{{ k.title }}”? Anything using it will no longer be able to access your repositories.">
27 <button class="btn btn-sm btn-danger" type="submit">Delete</button>
28 </form>
29 </div>
30 {% endfor %}
31 </div>
32 {% endif %}
33</section>
34<section class="settings-section">
35 <h2 class="settings-title">Add a new SSH key</h2>
36 {% if let Some(e) = error %}<div class="flash flash-error">{{ crate::web::fmt::icon("circle-alert")|safe }}<span>{{ e }}</span></div>{% endif %}
37 <form method="post" action="/settings/keys" class="form">
38 <label class="field">
39 <span class="field-label">Title</span>
40 <input class="input" type="text" name="title" value="{{ title }}" maxlength="100" placeholder="e.g. Work laptop">
41 <span class="field-hint">Defaults to the key's comment.</span>
42 </label>
43 <label class="field">
44 <span class="field-label">Key</span>
45 <textarea class="input input-mono" name="key" rows="5" required placeholder="Begins with 'ssh-ed25519', 'ssh-rsa', 'ecdsa-sha2-nistp256', ...">{{ key }}</textarea>
46 </label>
47 <div class="form-actions"><button class="btn btn-primary" type="submit">Add SSH key</button></div>
48 </form>
49</section>
50<section class="settings-section">
51 <h2 class="settings-title">Getting started</h2>
52 <div class="box box-body help-box">
53 <p>Generate a key if you don't have one, then paste the contents of the <code>.pub</code> file above:</p>
54 <pre class="command">ssh-keygen -t ed25519 -C "[email protected]"
55cat ~/.ssh/id_ed25519.pub</pre>
56 <p>Once added, check that the server accepts it:</p>
57 <div class="input-group">
58 <input class="input input-mono" type="text" readonly value="{{ test_command }}" id="ssh-test" aria-label="SSH test command">
59 <button type="button" class="btn" data-copy="#ssh-test" title="Copy">{{ crate::web::fmt::icon("copy")|safe }}</button>
60 </div>
61 </div>
62</section>
63{% endblock %}