certweb/templates/pubkeys/index.html
2019-09-24 21:23:02 +02:00

61 lines
2.6 KiB
HTML

{% extends 'base.html' %}
{% block header %}
<h1>{% block title %}
{% if g.user %}
Pubkeys for {{ g.user['fullname'] }}
{% else %}
Pubkeys
{% endif %}
{% endblock %}</h1>
{% if g.user %}
<a class="action" href="{{ url_for('pubkeys.create') }}">New</a>
{% endif %}
{% endblock %}
{% block content %}
{% if g.user %}
{% for pubkey in pubkeys %}
{% if pubkey['deleted'] == 0 %}
<article class="post{% if pubkey['revoked'] != 0 %} revoked{% endif %}{% if pubkey['deleted'] != 0 %} deleted{% endif %}">
<header>
<div>
<h1>
<a class="action" href="{{ url_for('pubkeys.certs_index', id=pubkey['id']) }}">
{% if pubkey['revoked'] != 0 %}
<div class="danger">revoked key<div> -
{% endif %}
({{ pubkey['id'] }}): {{ pubkey['key_name'] }}
</a>
</h1>
</div>
{% if g.user['id'] == pubkey['user_id'] %}
<a class="action" href="{{ url_for('pubkeys.update', id=pubkey['id']) }}">Edit</a>
{% if pubkey['deleted'] == 0 %}
<a class="action" href="{{ url_for('pubkeys.delete', id=pubkey['id']) }}" onclick="return confirm('Are you sure?');">Delete</a>
{% endif %}
{% if pubkey['revoked'] == 0 %}
<a class="action" href="{{ url_for('pubkeys.revoke', id=pubkey['id']) }}" onclick="return confirm('Are you sure?');">Revoke</a>
{% endif %}
{% endif %}
</header>
<div name="ssh_pubkey" id="ssh_pubkey">{{ request.form['ssh_pubkey'] or pubkey['ssh_pubkey'] }}</div>
<p class="about">registered on {{ pubkey['created'].strftime('%Y-%m-%d') }}</p>
</form>
<!--form action="{{ url_for('pubkeys.revoke', id=pubkey['id']) }}" method="POST">
<input class="danger" type="submit" value="Revoke" onclick="return confirm('Are you sure?');">
</form-->
<form action="{{ url_for('pubkeys.certs_index', id=pubkey['id']) }}" method="POST">
<input class="danger" type="submit" value="Certificates">
</form>
</article>
{% if not loop.last %}
<hr>
{% endif %}
{% endif %}
{% endfor %}
{% else %}
<div class="danger">To view pubkeys and certificates, please log in</div>
{% endif %}
{% endblock %}