File size: 4,982 Bytes
b4b2b21 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | {% extends "base.html" %}
{% block title %}Add Secret - PyRunner{% endblock %}
{% block content %}
<div class="flex">
{% include "cpanel/_sidebar.html" %}
<div class="flex-1 p-8">
<!-- Header -->
<div class="mb-8">
<nav class="flex items-center space-x-2 text-sm text-code-muted mb-4">
<a href="{% url 'cpanel:secret_list' %}" class="hover:text-code-accent">Secrets</a>
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
</svg>
<span class="text-code-text">Add Secret</span>
</nav>
<h1 class="text-2xl font-bold text-code-text">Add New Secret</h1>
<p class="text-code-muted">Store an encrypted credential for use in scripts</p>
</div>
<!-- Form -->
<div class="bg-code-surface border border-code-border rounded-xl p-6 max-w-2xl">
<form method="post" autocomplete="off">
{% csrf_token %}
<!-- Key Name -->
<div class="mb-6">
<label for="id_key" class="block text-sm font-medium text-code-text mb-2">
{{ form.key.label }}
</label>
{{ form.key }}
{% if form.key.help_text %}
<p class="mt-1 text-sm text-code-muted">{{ form.key.help_text }}</p>
{% endif %}
{% if form.key.errors %}
<p class="mt-1 text-sm text-code-red">{{ form.key.errors.0 }}</p>
{% endif %}
</div>
<!-- Secret Value -->
<div class="mb-6">
<label for="id_value" class="block text-sm font-medium text-code-text mb-2">
{{ form.value.label }}
</label>
{{ form.value }}
{% if form.value.help_text %}
<p class="mt-1 text-sm text-code-muted">{{ form.value.help_text }}</p>
{% endif %}
{% if form.value.errors %}
<p class="mt-1 text-sm text-code-red">{{ form.value.errors.0 }}</p>
{% endif %}
</div>
<!-- Description -->
<div class="mb-6">
<label for="id_description" class="block text-sm font-medium text-code-text mb-2">
{{ form.description.label }}
</label>
{{ form.description }}
{% if form.description.help_text %}
<p class="mt-1 text-sm text-code-muted">{{ form.description.help_text }}</p>
{% endif %}
{% if form.description.errors %}
<p class="mt-1 text-sm text-code-red">{{ form.description.errors.0 }}</p>
{% endif %}
</div>
<!-- Security Notice -->
<div class="mb-6 p-4 bg-code-bg border border-code-border rounded-lg">
<div class="flex items-start space-x-3">
<svg class="w-5 h-5 text-code-accent mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"/>
</svg>
<div class="text-sm text-code-muted">
<p class="font-medium text-code-text">Security</p>
<ul class="mt-1 space-y-1 list-disc list-inside">
<li>Secret values are encrypted at rest using Fernet</li>
<li>Full values are never displayed after creation</li>
<li>Secrets are injected as environment variables at runtime</li>
</ul>
</div>
</div>
</div>
<!-- Actions -->
<div class="flex items-center justify-end space-x-4 pt-6 border-t border-code-border">
<a href="{% url 'cpanel:secret_list' %}"
class="px-4 py-2 bg-code-surface border border-code-border hover:border-code-accent text-code-text rounded-lg transition-colors">
Cancel
</a>
<button type="submit"
class="px-4 py-2 bg-code-accent hover:bg-code-accent/90 text-white font-semibold rounded-lg transition-colors">
Add Secret
</button>
</div>
</form>
</div>
</div>
</div>
{% endblock %}
|