basisfunktion

This commit is contained in:
Jakobus Schürz 2019-10-17 08:14:13 +02:00
parent 947c3ee497
commit f69955d05e
4 changed files with 11 additions and 96 deletions

View file

@ -1,15 +0,0 @@
{% extends 'base.html' %}
{% block header %}
<h1>{% block title %}New Public Key{% endblock %}</h1>
{% endblock %}
{% block content %}
<form method="post">
<label for="key_name">Key Identifier</label>
<input name="key_name" id="key_name" value="{{ request.form['key_name'] }}">
<label for="ssh_pubkey">SSH-Pubkey</label>
<textarea name="ssh_pubkey" id="ssh_pubkey" required>{{ request.form['ssh_pubkey'] }}</textarea>
<input type="submit" value="Save">
</form>
{% endblock %}

View file

@ -9,7 +9,7 @@
{% endif %}
{% endblock %}</h1>
{% if g.user %}
<a class="action" href="{{ url_for('pubkeys.create') }}">New</a>
<a class="action" href="{{ url_for('pubkeys.addpubkey') }}">New</a>
{% endif %}
{% endblock %}
@ -22,9 +22,9 @@
<div>
<h1>
<!--a class="action" href="{{ url_for('pubkeys.certs_index', id=pubkey['id']) }}">
({{ pubkey['id'] }}): {{ pubkey['key_name'] }}
({{ pubkey['id'] }}): {{ pubkey['identity'] }}
</a-->
({{ pubkey['id'] }}): {{ pubkey['key_name'] }}
({{ pubkey['id'] }}): {{ pubkey['identity'] }}
</h1>
{% if pubkey['revoked'] != 0 %}
<div class="info">this pubkey was revoked manually</div>
@ -36,7 +36,7 @@
{% endif %}
{% if pubkey['revoked'] == 0 %}
<form action="{{ url_for('pubkeys.revoke', id=pubkey['id']) }}" method="POST">
<input class="danger" type="submit" value="Revoke cert" onclick="return confirm('Are you sure?');">
<input class="danger" type="submit" value="Revoke pubkey" onclick="return confirm('Are you sure?');">
</form>
{% else %}
<a class="action" href="{{ url_for('pubkeys.delete', id=pubkey['id']) }}" onclick="return confirm('Are you sure?');">Delete</a>
@ -49,7 +49,7 @@
<div name="owner" id="owner">owner: {{ pubkey['username']}}</div>
{% endif %}
<div>fingerprint: <div class="key" name="fingerprint" id="fingerprint">{{ pubkey['fingerprint'] }}</div></div>
<div>pubkey: <div class="key" name="ssh_pubkey" id="ssh_pubkey">{{ request.form['ssh_pubkey'] or pubkey['ssh_pubkey'] }}</div></div>
<div>pubkey: <div class="key" name="pubkey" id="pubkey">{{ request.form['pubkey'] or pubkey['pubkey'] }}</div></div>
</div>
<p class="about">registered on {{ pubkey['created'].strftime('%Y-%m-%d') }}</p>
<form action="{{ url_for('pubkeys.certs_index', id=pubkey['id']) }}" method="POST">

View file

@ -1,70 +0,0 @@
{% 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 and pubkey['user_id'] == g.user['id'] ) or user['admin'] == 1 %}
<article class="post{% if pubkey['deleted'] != 0 %} deleted{% endif %}">
<header>
<div>
<h1>
<a class="action" href="{{ url_for('pubkeys.certs_index', id=pubkey['id']) }}">
({{ pubkey['id'] }}): {{ pubkey['key_name'] }}
</a>
</h1>
{% if pubkey['revoked'] != 0 %}
<div class="info">this pubkey was revoked manually<div>
{% endif %}
</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>
<a class="action" href="{{ url_for('pubkeys.deletefinal', id=pubkey['id']) }}" onclick="return confirm('Are you sure?');">Delete final</a>
{% endif %}
{% if pubkey['revoked'] == 0 %}
<form action="{{ url_for('pubkeys.revoke', id=pubkey['id']) }}" method="POST">
<input class="danger" type="submit" value="Revoke cert" onclick="return confirm('Are you sure?');">
</form>
{% else %}
<div class="action">revoked</div>
<a class="action" href="{{ url_for('pubkeys.delete', id=pubkey['id']) }}">Delete</a>
{% endif %}
{% endif %}
</header>
<p class="body {% if pubkey['revoked'] != 0 %} revoked{% endif %}">
{% if user['admin'] == 1 %}
<div name="owner" id="owner">owner: {{ pubkey['username']}}</div>
{% endif %}
fingerprint: <div class="key" name="fingerprint" id="fingerprint">{{ pubkey['fingerprint'] }}</div>
<br>
pubkey: <div class="key" 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>
</p>
<form action="{{ url_for('pubkeys.certs_index', id=pubkey['id']) }}" method="POST">
<input 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 %}

View file

@ -9,12 +9,12 @@
<input class="danger" type="submit" value="Delete final" onclick="return confirm('Are you sure?');">
</form>
<form method="post">
<label for="key_name">SSH-Pubkey ({{ pubkey['id'] }}) {{ pubkey['deleted'] }}</label>
<input name="key_name" id="key_name"
value="{{ request.form['key_name'] or pubkey['key_name'] }}" required>
<label for="ssh_pubkey">SSH-Pubkey</label>
<textarea name="ssh_pubkey" id="ssh_pubkey" readonly>{{ request.form['ssh_pubkey'] or pubkey['ssh_pubkey'] }}</textarea>
<!--div class="about">{{ request.form['ssh_pubkey'] or pubkey['ssh_pubkey'] }}<div-->
<label for="identity">SSH-Pubkey ({{ pubkey['id'] }}) {{ pubkey['deleted'] }}</label>
<input name="identity" id="identity"
value="{{ request.form['identity'] or pubkey['identity'] }}" required>
<label for="pubkey">SSH-Pubkey</label>
<textarea name="pubkey" id="pubkey" readonly>{{ request.form['pubkey'] or pubkey['pubkey'] }}</textarea>
<!--div class="about">{{ request.form['pubkey'] or pubkey['pubkey'] }}<div-->
<div>
<input type="checkbox" name="deleted" id="deleted" {% if pubkey['deleted'] != 0 %}checked="checked" {% endif %}>
<label for="deleted">Key marked as deleted</label>