new file: .env.example

new file:   .gitignore
	new file:   Dockerfile
	new file:   README.md
	new file:   app.py
	new file:   auth.py
	new file:   config.py
	new file:   db.py
	new file:   db_helpers.py
	new file:   docker-compose.yml
	new file:   requirements.txt
	new file:   routes/__init__.py
	new file:   routes/admin_routes.py
	new file:   routes/auth_routes.py
	new file:   routes/journal_routes.py
	new file:   static/css/style.css
	new file:   static/js/main.js
	new file:   templates/admin/dashboard.html
	new file:   templates/admin/users.html
	new file:   templates/base.html
	new file:   templates/day.html
	new file:   templates/future.html
	new file:   templates/index.html
	new file:   templates/login.html
	new file:   templates/week.html
This commit is contained in:
SimolZimol
2026-08-02 20:41:24 +02:00
commit 0e7efe4b74
25 changed files with 1590 additions and 0 deletions

View File

@@ -0,0 +1,79 @@
{% extends "base.html" %}
{% block title %}Benutzerverwaltung Bullet Journal{% endblock %}
{% block content %}
<div class="page-head">
<div>
<h1>Benutzerverwaltung</h1>
<p class="muted">Accounts erstellen und verwalten</p>
</div>
</div>
<section class="card">
<h2>Neuen Benutzer anlegen</h2>
<form method="post" action="{{ url_for('admin.users') }}" class="note-form">
<div class="note-form-row">
<label>
Benutzername
<input type="text" name="username" required>
</label>
<label>
Passwort
<input type="text" name="password" required>
</label>
<label>
E-Mail
<input type="email" name="email">
</label>
<label class="checkbox-label">
<input type="checkbox" name="is_admin" value="1"> Admin
</label>
<button type="submit" class="btn btn-primary">Anlegen</button>
</div>
</form>
</section>
<section class="card">
<h2>Alle Benutzer</h2>
{% if users %}
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>Benutzername</th>
<th>E-Mail</th>
<th>Rolle</th>
<th>Notizen</th>
<th>Erstellt</th>
<th>Aktionen</th>
</tr>
</thead>
<tbody>
{% for u in users %}
<tr>
<td>{{ u.id }}</td>
<td>{{ u.username }}</td>
<td>{{ u.email or '' }}</td>
<td>{{ 'Admin' if u.is_admin else 'Benutzer' }}</td>
<td>{{ u.note_count }}</td>
<td>{{ u.created_at.strftime('%d.%m.%Y') if u.created_at else '' }}</td>
<td class="table-actions">
<form method="post" action="{{ url_for('admin.reset_password', user_id=u.id) }}" class="inline">
<input type="text" name="new_password" placeholder="Neues Passwort" required>
<button class="btn btn-small">PW zurücksetzen</button>
</form>
{% if u.id != session.get('user_id') %}
<form method="post" action="{{ url_for('admin.delete_user', user_id=u.id) }}" class="inline"
onsubmit="return confirm('Benutzer wirklich löschen? Alle Notizen gehen verloren.');">
<button class="btn btn-small btn-danger">Löschen</button>
</form>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="muted">Keine Benutzer vorhanden.</p>
{% endif %}
</section>
{% endblock %}