first commit

This commit is contained in:
Stefan Hacker
2026-02-12 12:10:30 +01:00
commit 272e2d6090
8 changed files with 400 additions and 0 deletions
+58
View File
@@ -0,0 +1,58 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}Docker Registry{% endblock %}</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #f3f4f6; color: #1f2937; min-height: 100vh; }
header { background: #1e293b; color: #fff; padding: 1rem 2rem; display: flex; justify-content: space-between; align-items: center; }
header h1 { font-size: 1.25rem; font-weight: 600; }
header a { color: #94a3b8; text-decoration: none; font-size: 0.9rem; }
header a:hover { color: #fff; }
.container { max-width: 900px; margin: 2rem auto; padding: 0 1rem; }
.card { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); padding: 1.5rem; margin-bottom: 1.5rem; }
.card h2 { font-size: 1.1rem; margin-bottom: 1rem; color: #374151; }
.flash { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.9rem; }
.flash.success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.flash.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.75rem; border-bottom: 1px solid #e5e7eb; }
th { font-size: 0.8rem; text-transform: uppercase; color: #6b7280; font-weight: 600; }
tr:last-child td { border-bottom: none; }
input[type="text"], input[type="password"] { padding: 0.5rem 0.75rem; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.9rem; width: 100%; }
input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.btn { padding: 0.5rem 1rem; border: none; border-radius: 6px; font-size: 0.85rem; cursor: pointer; font-weight: 500; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-secondary { background: #6b7280; color: #fff; }
.btn-secondary:hover { background: #4b5563; }
.form-row { display: flex; gap: 0.75rem; align-items: end; }
.form-group { flex: 1; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 600; color: #374151; margin-bottom: 0.25rem; }
.actions { display: flex; gap: 0.5rem; align-items: center; }
.inline-form { display: flex; gap: 0.5rem; align-items: center; }
.inline-form input { width: 150px; }
.empty { text-align: center; padding: 2rem; color: #9ca3af; }
</style>
</head>
<body>
<header>
<h1>Docker Registry</h1>
{% if session.get('logged_in') %}
<a href="{{ url_for('logout') }}">Abmelden</a>
{% endif %}
</header>
<div class="container">
{% with messages = get_flashed_messages(with_categories=true) %}
{% for category, message in messages %}
<div class="flash {{ category }}">{{ message }}</div>
{% endfor %}
{% endwith %}
{% block content %}{% endblock %}
</div>
</body>
</html>
+20
View File
@@ -0,0 +1,20 @@
{% extends "base.html" %}
{% block title %}Anmelden - Docker Registry{% endblock %}
{% block content %}
<div style="max-width: 400px; margin: 4rem auto;">
<div class="card">
<h2>Anmelden</h2>
<form method="post" action="{{ url_for('login') }}">
<div class="form-group" style="margin-bottom: 1rem;">
<label for="username">Benutzername</label>
<input type="text" id="username" name="username" required autofocus>
</div>
<div class="form-group" style="margin-bottom: 1rem;">
<label for="password">Passwort</label>
<input type="password" id="password" name="password" required>
</div>
<button type="submit" class="btn btn-primary" style="width: 100%;">Anmelden</button>
</form>
</div>
</div>
{% endblock %}
+70
View File
@@ -0,0 +1,70 @@
{% extends "base.html" %}
{% block title %}Benutzerverwaltung - Docker Registry{% endblock %}
{% block content %}
<div class="card">
<h2>Neuen Benutzer anlegen</h2>
<form method="post" action="{{ url_for('add_user') }}">
<div class="form-row">
<div class="form-group">
<label for="username">Benutzername</label>
<input type="text" id="username" name="username" required placeholder="z.B. deploy-user">
</div>
<div class="form-group">
<label for="password">Passwort</label>
<input type="password" id="password" name="password" required placeholder="Min. 6 Zeichen" minlength="6">
</div>
<div>
<button type="submit" class="btn btn-primary">Anlegen</button>
</div>
</div>
</form>
</div>
<div class="card">
<h2>Registry-Benutzer</h2>
{% if users %}
<table>
<thead>
<tr>
<th>Benutzername</th>
<th>Erstellt am</th>
<th>Passwort aendern</th>
<th></th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td><strong>{{ user.username }}</strong></td>
<td>{{ user.created_at }}</td>
<td>
<form method="post" action="{{ url_for('change_password', user_id=user.id) }}" class="inline-form">
<input type="password" name="password" placeholder="Neues Passwort" required minlength="6">
<button type="submit" class="btn btn-secondary">Aendern</button>
</form>
</td>
<td>
<form method="post" action="{{ url_for('delete_user', user_id=user.id) }}"
onsubmit="return confirm('Benutzer &quot;{{ user.username }}&quot; wirklich loeschen?')">
<button type="submit" class="btn btn-danger">Loeschen</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="empty">Noch keine Benutzer angelegt.</p>
{% endif %}
</div>
<div class="card">
<h2>Nutzung</h2>
<p style="font-size: 0.9rem; color: #6b7280; line-height: 1.6;">
Nach dem Anlegen eines Benutzers kann sich dieser mit <code>docker login {{ request.host }}</code> anmelden
und Images pushen/pullen.
</p>
</div>
{% endblock %}