OIDC Integration: Supports Authentik officially, other solutions currently untested. Social login not implemented
This commit is contained in:
1 parent
dfea7e869b
commit
68bbb53976
28 files changed
+2365
-751
No files matched your search
@@ -9,50 +9,92 @@
|
||||
<h1 class="text-2xl font-semibold tracking-tight text-gray-900">Welcome back</h1>
|
||||
<p class="text-sm text-gray-500">Sign in to manage server access and certificates.</p>
|
||||
</div>
|
||||
{% if show_sso_choice %}
|
||||
<div class="mt-6 space-y-3">
|
||||
{% if oidc_enabled %}
|
||||
<a
|
||||
href="{{ oidc_login_url }}"
|
||||
class="inline-flex w-full items-center justify-center rounded-lg bg-blue-700 px-5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300"
|
||||
>
|
||||
Login with {{ oidc_provider_label }}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% for provider in social_providers %}
|
||||
<a
|
||||
href="{{ provider.login_url }}"
|
||||
class="inline-flex w-full items-center justify-center rounded-lg border border-gray-300 bg-white px-5 py-2.5 text-sm font-semibold text-gray-800 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-4 focus:ring-gray-200"
|
||||
>
|
||||
Login with {{ provider.name }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<form method="post" class="mt-6 space-y-5">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="next" value="{% url 'servers:dashboard' %}">
|
||||
<div>
|
||||
<label class="mb-2 block text-sm font-medium text-gray-900">Username</label>
|
||||
<input
|
||||
type="text"
|
||||
name="username"
|
||||
autocomplete="username"
|
||||
required
|
||||
class="block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500"
|
||||
>
|
||||
</div>
|
||||
<div>
|
||||
<label class="mb-2 block text-sm font-medium text-gray-900">Password</label>
|
||||
<input
|
||||
type="password"
|
||||
name="password"
|
||||
autocomplete="current-password"
|
||||
required
|
||||
class="block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500"
|
||||
>
|
||||
</div>
|
||||
{% if form.errors %}
|
||||
<div class="flex items-center gap-2 rounded-lg bg-red-50 p-3 text-sm text-red-800" role="alert">
|
||||
<span class="font-medium">Sign-in failed.</span>
|
||||
<span>Please check your username and password.</span>
|
||||
{% if can_use_native_login %}
|
||||
<div class="mt-6 border-t border-gray-200 pt-6">
|
||||
<a
|
||||
href="{% url 'accounts:login' %}?native=1"
|
||||
class="inline-flex w-full items-center justify-center rounded-lg border border-gray-200 bg-gray-50 px-5 py-2.5 text-sm font-semibold text-gray-800 hover:bg-gray-100 focus:outline-none focus:ring-4 focus:ring-gray-200"
|
||||
>
|
||||
Log in with Keywarden
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
<button
|
||||
type="submit"
|
||||
class="inline-flex w-full items-center justify-center rounded-lg bg-blue-700 px-5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300"
|
||||
>
|
||||
Sign in
|
||||
</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<form method="post" class="mt-6 space-y-5">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="next" value="{% url 'servers:dashboard' %}">
|
||||
{% if messages %}
|
||||
{% for message in messages %}
|
||||
<div class="rounded-lg bg-red-50 p-3 text-sm text-red-800" role="alert">
|
||||
{{ message }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
<div>
|
||||
<label class="mb-2 block text-sm font-medium text-gray-900">Username</label>
|
||||
<input
|
||||
type="text"
|
||||
name="username"
|
||||
autocomplete="username"
|
||||
required
|
||||
class="block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500"
|
||||
>
|
||||
</div>
|
||||
<div>
|
||||
<label class="mb-2 block text-sm font-medium text-gray-900">Password</label>
|
||||
<input
|
||||
type="password"
|
||||
name="password"
|
||||
autocomplete="current-password"
|
||||
required
|
||||
class="block w-full rounded-lg border border-gray-300 bg-gray-50 p-2.5 text-sm text-gray-900 focus:border-blue-500 focus:ring-blue-500"
|
||||
>
|
||||
</div>
|
||||
{% if form.errors %}
|
||||
<div class="flex items-center gap-2 rounded-lg bg-red-50 p-3 text-sm text-red-800" role="alert">
|
||||
<span class="font-medium">Sign-in failed.</span>
|
||||
<span>Please check your username and password.</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
<button
|
||||
type="submit"
|
||||
class="inline-flex w-full items-center justify-center rounded-lg bg-blue-700 px-5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300"
|
||||
>
|
||||
Sign in
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<div class="mt-6 border-t border-gray-200 pt-6">
|
||||
<p class="text-sm text-gray-600">
|
||||
Or, if configured, use
|
||||
<a href="/oidc/authenticate/" class="font-medium text-blue-700 hover:underline">OIDC login</a>.
|
||||
</p>
|
||||
</div>
|
||||
{% if oidc_enabled or social_providers %}
|
||||
<div class="mt-6 border-t border-gray-200 pt-6">
|
||||
<a
|
||||
href="{% url 'accounts:login' %}"
|
||||
class="inline-flex w-full items-center justify-center rounded-lg border border-gray-200 bg-white px-5 py-2.5 text-sm font-semibold text-gray-800 hover:bg-gray-50 focus:outline-none focus:ring-4 focus:ring-gray-200"
|
||||
>
|
||||
Back to SSO options
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -3,9 +3,9 @@
|
||||
{% block title %}Profile • Keywarden{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="space-y-6">
|
||||
<div class="grid gap-6 lg:grid-cols-3">
|
||||
<section class="rounded-2xl border border-gray-200 bg-white p-6 shadow-sm lg:col-span-2">
|
||||
<div class="grid gap-6 lg:grid-cols-[minmax(0,2fr)_minmax(340px,1fr)] lg:items-start">
|
||||
<div class="space-y-6">
|
||||
<section class="rounded-2xl border border-gray-200 bg-white p-6 shadow-sm">
|
||||
<div class="space-y-2">
|
||||
<h1 class="text-xl font-semibold tracking-tight text-gray-900">Your Profile</h1>
|
||||
<p class="text-sm text-gray-500">Account details and contact information.</p>
|
||||
@@ -30,196 +30,311 @@
|
||||
</dl>
|
||||
</section>
|
||||
|
||||
<section class="rounded-2xl border border-gray-200 bg-white p-6 shadow-sm">
|
||||
<div class="flex flex-wrap items-start justify-between gap-4">
|
||||
<div>
|
||||
<h2 class="text-base font-semibold text-gray-900">SSH certificates</h2>
|
||||
<p class="mt-1 text-sm text-gray-500">
|
||||
Upload your SSH public key to receive a signed certificate for server access.
|
||||
</p>
|
||||
</div>
|
||||
<span class="inline-flex items-center rounded-full bg-blue-50 px-2.5 py-1 text-xs font-semibold text-blue-700">Certificates</span>
|
||||
</div>
|
||||
|
||||
{% if can_add_key %}
|
||||
<form method="post" class="mt-6 grid gap-4 lg:grid-cols-2">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="form_type" value="ssh_key">
|
||||
<div>
|
||||
<label for="{{ key_form.name.id_for_label }}" class="mb-2 block text-sm font-medium text-gray-900">
|
||||
Key name
|
||||
</label>
|
||||
{{ key_form.name }}
|
||||
{% if key_form.name.errors %}
|
||||
<p class="mt-1 text-sm text-red-600">{{ key_form.name.errors|striptags }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="lg:col-span-2">
|
||||
<label for="{{ key_form.public_key.id_for_label }}" class="mb-2 block text-sm font-medium text-gray-900">
|
||||
SSH public key
|
||||
</label>
|
||||
{{ key_form.public_key }}
|
||||
{% if key_form.public_key.errors %}
|
||||
<p class="mt-1 text-sm text-red-600">{{ key_form.public_key.errors|striptags }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if key_form.non_field_errors %}
|
||||
<p class="text-sm text-red-600">{{ key_form.non_field_errors|striptags }}</p>
|
||||
{% endif %}
|
||||
<div>
|
||||
<button
|
||||
type="submit"
|
||||
class="inline-flex items-center rounded-lg bg-blue-700 px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300"
|
||||
>
|
||||
Upload key
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
{% else %}
|
||||
<p class="mt-4 text-sm text-gray-600">You do not have permission to add SSH keys.</p>
|
||||
{% endif %}
|
||||
|
||||
{% if ssh_keys %}
|
||||
<div class="mt-6 overflow-hidden rounded-xl border border-gray-200">
|
||||
<table class="w-full text-left text-sm text-gray-500">
|
||||
<thead class="bg-gray-50 text-xs uppercase text-gray-500">
|
||||
<tr>
|
||||
<th scope="col" class="px-6 py-3">Key</th>
|
||||
<th scope="col" class="px-6 py-3">Fingerprint</th>
|
||||
<th scope="col" class="px-6 py-3 text-right">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for key in ssh_keys %}
|
||||
<tr class="border-t bg-white">
|
||||
<th scope="row" class="px-6 py-4 font-medium text-gray-900">
|
||||
{{ key.name }}
|
||||
</th>
|
||||
<td class="px-6 py-4 text-xs text-gray-500">{{ key.fingerprint }}</td>
|
||||
<td class="px-6 py-4">
|
||||
<div class="flex flex-wrap items-center justify-end gap-2">
|
||||
{% if key.is_active %}
|
||||
<span class="inline-flex items-center rounded-full bg-emerald-100 px-2.5 py-0.5 text-xs font-medium text-emerald-800">Active</span>
|
||||
<div class="inline-flex rounded-lg shadow-sm" role="group">
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center rounded-l-lg bg-blue-700 px-3 py-1.5 text-xs font-semibold text-white hover:bg-blue-800 focus:outline-none focus:ring-2 focus:ring-blue-300"
|
||||
data-download-url="/api/v1/keys/{{ key.id }}/certificate"
|
||||
>
|
||||
Download
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center rounded-r-lg border border-gray-200 bg-white px-3 py-1.5 text-xs font-semibold text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-300"
|
||||
data-download-url="/api/v1/keys/{{ key.id }}/certificate.sha256"
|
||||
>
|
||||
Hash
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center rounded-lg bg-rose-600 px-3 py-1.5 text-xs font-semibold text-white hover:bg-rose-700 focus:outline-none focus:ring-2 focus:ring-rose-300 js-regenerate-cert"
|
||||
data-key-id="{{ key.id }}"
|
||||
>
|
||||
Regenerate
|
||||
</button>
|
||||
{% else %}
|
||||
<span class="inline-flex items-center rounded-full bg-gray-200 px-2.5 py-0.5 text-xs font-medium text-gray-700">Revoked</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% else %}
|
||||
<p class="mt-4 text-sm text-gray-600">No SSH keys uploaded yet.</p>
|
||||
{% endif %}
|
||||
</section>
|
||||
|
||||
<section class="rounded-2xl border border-gray-200 bg-white p-6 shadow-sm">
|
||||
<div class="flex flex-wrap items-start justify-between gap-4">
|
||||
<div>
|
||||
<h2 class="text-base font-semibold text-gray-900">Data erasure request</h2>
|
||||
<p class="mt-1 text-sm text-gray-500">
|
||||
Submit a GDPR erasure request to anonymize your account data. An administrator
|
||||
must review and approve the request before processing.
|
||||
</p>
|
||||
</div>
|
||||
<span class="inline-flex items-center rounded-full bg-gray-100 px-2.5 py-1 text-xs font-semibold text-gray-700">GDPR</span>
|
||||
</div>
|
||||
|
||||
{% if erasure_request %}
|
||||
<div class="mt-4 rounded-lg border border-gray-200 bg-gray-50 p-4 text-sm text-gray-700">
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<span class="text-xs font-semibold uppercase tracking-wide text-gray-500">Status</span>
|
||||
<span class="inline-flex items-center rounded-full bg-gray-200 px-2.5 py-1 text-xs font-semibold text-gray-700">
|
||||
{{ erasure_request.status|capfirst }}
|
||||
</span>
|
||||
<span class="text-gray-500">Requested {{ erasure_request.requested_at|date:"M j, Y H:i" }}</span>
|
||||
</div>
|
||||
{% if erasure_request.decided_at %}
|
||||
<p class="mt-2 text-gray-600">
|
||||
Decision {{ erasure_request.decided_at|date:"M j, Y H:i" }}.
|
||||
{% if erasure_request.decision_reason %}
|
||||
Reason: {{ erasure_request.decision_reason }}
|
||||
{% endif %}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if erasure_request.status == "processed" %}
|
||||
<p class="mt-2 text-gray-600">
|
||||
Your account has been anonymized. Access has been revoked and SSH keys disabled.
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if not erasure_request or erasure_request.status != "pending" %}
|
||||
<form method="post" class="mt-6 grid gap-4">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="form_type" value="erasure">
|
||||
<div>
|
||||
<label for="{{ erasure_form.reason.id_for_label }}" class="mb-2 block text-sm font-medium text-gray-900">
|
||||
Reason for request
|
||||
</label>
|
||||
{{ erasure_form.reason }}
|
||||
{% if erasure_form.reason.errors %}
|
||||
<p class="mt-1 text-sm text-red-600">{{ erasure_form.reason.errors|striptags }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if erasure_form.non_field_errors %}
|
||||
<p class="text-sm text-red-600">{{ erasure_form.non_field_errors|striptags }}</p>
|
||||
{% endif %}
|
||||
<div>
|
||||
<button
|
||||
type="submit"
|
||||
class="inline-flex items-center rounded-lg bg-blue-700 px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300"
|
||||
>
|
||||
Submit erasure request
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
{% endif %}
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<aside class="space-y-6 lg:sticky lg:top-6">
|
||||
<section class="rounded-2xl border border-gray-200 bg-white p-6 shadow-sm">
|
||||
<div class="space-y-2">
|
||||
<h2 class="text-base font-semibold text-gray-900">Single Sign-On</h2>
|
||||
<p class="text-sm text-gray-500">Manage how you authenticate with external providers.</p>
|
||||
</div>
|
||||
<div class="mt-4 rounded-xl border border-dashed border-gray-200 bg-gray-50 p-4 text-sm text-gray-600">
|
||||
{% if auth_mode == "hybrid" %}
|
||||
Optional: Link your account with your identity provider for single sign-on.
|
||||
<a href="/oidc/authenticate/" class="font-semibold text-blue-700 hover:underline">Link with SSO</a>
|
||||
{% elif auth_mode == "oidc" %}
|
||||
OIDC is required. Sign-in is managed by your identity provider.
|
||||
{% else %}
|
||||
OIDC is disabled. You are using native authentication.
|
||||
{% endif %}
|
||||
<div class="mt-4 space-y-5">
|
||||
<article class="overflow-hidden rounded-xl border border-gray-200">
|
||||
<div class="flex items-center justify-between bg-gray-50 px-4 py-3">
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="inline-flex h-6 w-6 items-center justify-center rounded-full bg-blue-100 text-[11px] font-bold text-blue-700">OIDC</span>
|
||||
<h3 class="text-sm font-semibold text-gray-900">Identity Provider</h3>
|
||||
</div>
|
||||
{% if oidc_identity %}
|
||||
<span class="inline-flex items-center rounded-full bg-emerald-100 px-2.5 py-1 text-xs font-semibold text-emerald-700">Linked</span>
|
||||
{% elif oidc_enabled %}
|
||||
<span class="inline-flex items-center rounded-full bg-amber-100 px-2.5 py-1 text-xs font-semibold text-amber-700">Not linked</span>
|
||||
{% else %}
|
||||
<span class="inline-flex items-center rounded-full bg-gray-200 px-2.5 py-1 text-xs font-semibold text-gray-700">Unavailable</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="space-y-3 p-4">
|
||||
{% if oidc_identity %}
|
||||
<dl class="grid grid-cols-1 gap-2 text-xs text-gray-600">
|
||||
<div class="grid grid-cols-[96px,1fr] items-start gap-2">
|
||||
<dt class="font-semibold text-gray-700">Provider</dt>
|
||||
<dd>{{ oidc_identity.provider_id|default:oidc_provider_id }}</dd>
|
||||
</div>
|
||||
{% if oidc_issuer %}
|
||||
<div class="grid grid-cols-[96px,1fr] items-start gap-2">
|
||||
<dt class="font-semibold text-gray-700">Issuer</dt>
|
||||
<dd class="break-all">{{ oidc_issuer }}</dd>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="grid grid-cols-[96px,1fr] items-start gap-2">
|
||||
<dt class="font-semibold text-gray-700">Subject</dt>
|
||||
<dd class="break-all font-mono">{{ oidc_identity.subject }}</dd>
|
||||
</div>
|
||||
<div class="grid grid-cols-[96px,1fr] items-start gap-2">
|
||||
<dt class="font-semibold text-gray-700">Linked email</dt>
|
||||
<dd>{{ oidc_identity.email_at_link }}</dd>
|
||||
</div>
|
||||
{% if oidc_identity.last_login_at %}
|
||||
<div class="grid grid-cols-[96px,1fr] items-start gap-2">
|
||||
<dt class="font-semibold text-gray-700">Last login</dt>
|
||||
<dd>{{ oidc_identity.last_login_at|date:"M j, Y H:i" }}</dd>
|
||||
</div>
|
||||
{% endif %}
|
||||
</dl>
|
||||
<a
|
||||
href="/oidc/authenticate/"
|
||||
class="inline-flex items-center rounded-lg border border-blue-200 bg-blue-50 px-3 py-1.5 text-xs font-semibold text-blue-700 hover:bg-blue-100"
|
||||
>
|
||||
Refresh OIDC session
|
||||
</a>
|
||||
{% elif oidc_enabled %}
|
||||
<p class="text-sm text-gray-600">
|
||||
{% if auth_mode == "oidc" %}
|
||||
OIDC is required for this deployment and links automatically when sign-in succeeds.
|
||||
{% else %}
|
||||
Link your account to the configured identity provider to use single sign-on.
|
||||
{% endif %}
|
||||
</p>
|
||||
<a
|
||||
href="/oidc/authenticate/"
|
||||
class="inline-flex items-center rounded-lg bg-blue-700 px-3 py-1.5 text-xs font-semibold text-white hover:bg-blue-800 focus:outline-none focus:ring-2 focus:ring-blue-300"
|
||||
>
|
||||
Link OIDC
|
||||
</a>
|
||||
{% else %}
|
||||
<p class="text-sm text-gray-600">
|
||||
OIDC is not configured in this environment.
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</article>
|
||||
|
||||
<article class="overflow-hidden rounded-xl border border-gray-200">
|
||||
<div class="flex items-center justify-between bg-gray-50 px-4 py-3">
|
||||
<h3 class="text-sm font-semibold text-gray-900">Social Providers</h3>
|
||||
<span class="text-xs text-gray-500">GitHub, Google, Apple and more</span>
|
||||
</div>
|
||||
<div class="divide-y divide-gray-100">
|
||||
{% for provider in social_provider_cards %}
|
||||
<div class="flex flex-wrap items-center justify-between gap-3 px-4 py-3">
|
||||
<div class="min-w-0">
|
||||
<p class="text-sm font-semibold text-gray-900">{{ provider.name }}</p>
|
||||
{% if provider.linked and provider.identity %}
|
||||
<p class="text-xs text-gray-600">
|
||||
Linked as {{ provider.identity.email_at_link }}
|
||||
{% if provider.identity.last_login_at %}• last login {{ provider.identity.last_login_at|date:"M j, Y H:i" }}{% endif %}
|
||||
</p>
|
||||
{% elif provider.configured %}
|
||||
<p class="text-xs text-gray-600">Configured and ready to link.</p>
|
||||
{% else %}
|
||||
<p class="text-xs text-gray-500">Placeholder. Configure provider credentials to enable linking.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
{% if provider.linked %}
|
||||
<span class="inline-flex items-center rounded-full bg-emerald-100 px-2 py-0.5 text-[11px] font-semibold text-emerald-700">Linked</span>
|
||||
{% elif provider.configured %}
|
||||
<span class="inline-flex items-center rounded-full bg-amber-100 px-2 py-0.5 text-[11px] font-semibold text-amber-700">Ready</span>
|
||||
{% else %}
|
||||
<span class="inline-flex items-center rounded-full bg-gray-200 px-2 py-0.5 text-[11px] font-semibold text-gray-700">Placeholder</span>
|
||||
{% endif %}
|
||||
|
||||
{% if provider.configured %}
|
||||
<a
|
||||
href="{{ provider.login_url }}"
|
||||
class="inline-flex items-center rounded-lg bg-blue-700 px-3 py-1.5 text-xs font-semibold text-white hover:bg-blue-800 focus:outline-none focus:ring-2 focus:ring-blue-300"
|
||||
>
|
||||
{% if provider.linked %}Re-link{% else %}Link{% endif %}
|
||||
</a>
|
||||
{% else %}
|
||||
<button
|
||||
type="button"
|
||||
disabled
|
||||
class="inline-flex cursor-not-allowed items-center rounded-lg border border-gray-200 bg-gray-100 px-3 py-1.5 text-xs font-semibold text-gray-500"
|
||||
>
|
||||
Configure
|
||||
</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<section class="rounded-2xl border border-gray-200 bg-white p-6 shadow-sm">
|
||||
<div class="flex flex-wrap items-start justify-between gap-4">
|
||||
<div>
|
||||
<h2 class="text-base font-semibold text-gray-900">SSH certificates</h2>
|
||||
<p class="mt-1 text-sm text-gray-500">
|
||||
Upload your SSH public key to receive a signed certificate for server access.
|
||||
</p>
|
||||
</div>
|
||||
<span class="inline-flex items-center rounded-full bg-blue-50 px-2.5 py-1 text-xs font-semibold text-blue-700">Certificates</span>
|
||||
</div>
|
||||
|
||||
{% if can_add_key %}
|
||||
<form method="post" class="mt-6 grid gap-4 lg:grid-cols-2">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="form_type" value="ssh_key">
|
||||
<div>
|
||||
<label for="{{ key_form.name.id_for_label }}" class="mb-2 block text-sm font-medium text-gray-900">
|
||||
Key name
|
||||
</label>
|
||||
{{ key_form.name }}
|
||||
{% if key_form.name.errors %}
|
||||
<p class="mt-1 text-sm text-red-600">{{ key_form.name.errors|striptags }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="lg:col-span-2">
|
||||
<label for="{{ key_form.public_key.id_for_label }}" class="mb-2 block text-sm font-medium text-gray-900">
|
||||
SSH public key
|
||||
</label>
|
||||
{{ key_form.public_key }}
|
||||
{% if key_form.public_key.errors %}
|
||||
<p class="mt-1 text-sm text-red-600">{{ key_form.public_key.errors|striptags }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if key_form.non_field_errors %}
|
||||
<p class="text-sm text-red-600">{{ key_form.non_field_errors|striptags }}</p>
|
||||
{% endif %}
|
||||
<div>
|
||||
<button
|
||||
type="submit"
|
||||
class="inline-flex items-center rounded-lg bg-blue-700 px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300"
|
||||
>
|
||||
Upload key
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
{% else %}
|
||||
<p class="mt-4 text-sm text-gray-600">You do not have permission to add SSH keys.</p>
|
||||
{% endif %}
|
||||
|
||||
{% if ssh_keys %}
|
||||
<div class="mt-6 overflow-hidden rounded-xl border border-gray-200">
|
||||
<table class="w-full text-left text-sm text-gray-500">
|
||||
<thead class="bg-gray-50 text-xs uppercase text-gray-500">
|
||||
<tr>
|
||||
<th scope="col" class="px-6 py-3">Key</th>
|
||||
<th scope="col" class="px-6 py-3">Fingerprint</th>
|
||||
<th scope="col" class="px-6 py-3 text-right">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for key in ssh_keys %}
|
||||
<tr class="border-t bg-white">
|
||||
<th scope="row" class="px-6 py-4 font-medium text-gray-900">
|
||||
{{ key.name }}
|
||||
</th>
|
||||
<td class="px-6 py-4 text-xs text-gray-500">{{ key.fingerprint }}</td>
|
||||
<td class="px-6 py-4">
|
||||
<div class="flex flex-wrap items-center justify-end gap-2">
|
||||
{% if key.is_active %}
|
||||
<span class="inline-flex items-center rounded-full bg-emerald-100 px-2.5 py-0.5 text-xs font-medium text-emerald-800">Active</span>
|
||||
<div class="inline-flex rounded-lg shadow-sm" role="group">
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center rounded-l-lg bg-blue-700 px-3 py-1.5 text-xs font-semibold text-white hover:bg-blue-800 focus:outline-none focus:ring-2 focus:ring-blue-300"
|
||||
data-download-url="/api/v1/keys/{{ key.id }}/certificate"
|
||||
>
|
||||
Download
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center rounded-r-lg border border-gray-200 bg-white px-3 py-1.5 text-xs font-semibold text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-300"
|
||||
data-download-url="/api/v1/keys/{{ key.id }}/certificate.sha256"
|
||||
>
|
||||
Hash
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center rounded-lg bg-rose-600 px-3 py-1.5 text-xs font-semibold text-white hover:bg-rose-700 focus:outline-none focus:ring-2 focus:ring-rose-300 js-regenerate-cert"
|
||||
data-key-id="{{ key.id }}"
|
||||
>
|
||||
Regenerate
|
||||
</button>
|
||||
{% else %}
|
||||
<span class="inline-flex items-center rounded-full bg-gray-200 px-2.5 py-0.5 text-xs font-medium text-gray-700">Revoked</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% else %}
|
||||
<p class="mt-4 text-sm text-gray-600">No SSH keys uploaded yet.</p>
|
||||
{% endif %}
|
||||
</section>
|
||||
|
||||
<section class="rounded-2xl border border-gray-200 bg-white p-6 shadow-sm">
|
||||
<div class="flex flex-wrap items-start justify-between gap-4">
|
||||
<div>
|
||||
<h2 class="text-base font-semibold text-gray-900">Data erasure request</h2>
|
||||
<p class="mt-1 text-sm text-gray-500">
|
||||
Submit a GDPR erasure request to anonymize your account data. An administrator
|
||||
must review and approve the request before processing.
|
||||
</p>
|
||||
</div>
|
||||
<span class="inline-flex items-center rounded-full bg-gray-100 px-2.5 py-1 text-xs font-semibold text-gray-700">GDPR</span>
|
||||
</div>
|
||||
|
||||
{% if erasure_request %}
|
||||
<div class="mt-4 rounded-lg border border-gray-200 bg-gray-50 p-4 text-sm text-gray-700">
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<span class="text-xs font-semibold uppercase tracking-wide text-gray-500">Status</span>
|
||||
<span class="inline-flex items-center rounded-full bg-gray-200 px-2.5 py-1 text-xs font-semibold text-gray-700">
|
||||
{{ erasure_request.status|capfirst }}
|
||||
</span>
|
||||
<span class="text-gray-500">Requested {{ erasure_request.requested_at|date:"M j, Y H:i" }}</span>
|
||||
</div>
|
||||
{% if erasure_request.decided_at %}
|
||||
<p class="mt-2 text-gray-600">
|
||||
Decision {{ erasure_request.decided_at|date:"M j, Y H:i" }}.
|
||||
{% if erasure_request.decision_reason %}
|
||||
Reason: {{ erasure_request.decision_reason }}
|
||||
{% endif %}
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if erasure_request.status == "processed" %}
|
||||
<p class="mt-2 text-gray-600">
|
||||
Your account has been anonymized. Access has been revoked and SSH keys disabled.
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if not erasure_request or erasure_request.status != "pending" %}
|
||||
<form method="post" class="mt-6 grid gap-4">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="form_type" value="erasure">
|
||||
<div>
|
||||
<label for="{{ erasure_form.reason.id_for_label }}" class="mb-2 block text-sm font-medium text-gray-900">
|
||||
Reason for request
|
||||
</label>
|
||||
{{ erasure_form.reason }}
|
||||
{% if erasure_form.reason.errors %}
|
||||
<p class="mt-1 text-sm text-red-600">{{ erasure_form.reason.errors|striptags }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if erasure_form.non_field_errors %}
|
||||
<p class="text-sm text-red-600">{{ erasure_form.non_field_errors|striptags }}</p>
|
||||
{% endif %}
|
||||
<div>
|
||||
<button
|
||||
type="submit"
|
||||
class="inline-flex items-center rounded-lg bg-blue-700 px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-800 focus:outline-none focus:ring-4 focus:ring-blue-300"
|
||||
>
|
||||
Submit erasure request
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
{% endif %}
|
||||
</section>
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
Reference in new issue
Block a user