Files
51l3nt51n-blog/templates/dashboard.html

70 lines
2.1 KiB
HTML

{% extends "base.html" %}
{% block title %}Dashboard{% endblock %}
{% block content %}
<h2>Dashboard</h2>
<form method="POST" action="/__dungeon/logout" style="display:inline;">
<input type="submit" value="Logout ({{ current_user.username }})">
</form>
<br><br>
<b>Features</b><br>
<ul>
<li><a href="/__dungeon/posts">Manage Blog Posts</a></li>
<li><a href="/__dungeon/attachments">Manage Attachments</a></li>
</ul>
<br>
<b>System Users</b><br>
{% if let Some(err) = error %}
<font color="red"><b>{{ err }}</b></font><br>
{% endif %}
<table border="1" cellpadding="5" cellspacing="0">
<tr>
<th>ID</th>
<th>Username</th>
<th>Role</th>
{% if current_user.role == "admin" %}
<th>Actions</th>
{% endif %}
</tr>
{% for user in users %}
<tr>
<td>{{ user.id }}</td>
<td><a href="#">{{ user.username }}</a></td>
<td>{{ user.role }}</td>
{% if current_user.role == "admin" %}
<td>
{% if user.id != current_user.id %}
<form method="POST" action="/__dungeon/users/delete/{{ user.id }}" style="display:inline;">
<input type="submit" value="Delete User">
</form>
{% endif %}
<form method="POST" action="/__dungeon/users/password/{{ user.id }}" style="display:inline;">
<input type="password" name="password" placeholder="New Password" required size="10">
<input type="submit" value="Change Password">
</form>
</td>
{% endif %}
</tr>
{% endfor %}
</table>
{% if current_user.role == "admin" %}
<br>
<b>System Administration - Add New User</b><br>
<form method="POST" action="/__dungeon/users/add">
Username: <input type="text" name="username" required size="15"><br>
Password: <input type="password" name="password" required size="15"><br>
Role:
<select name="role">
<option value="readonly">Read Only</option>
<option value="admin">Admin</option>
</select><br><br>
<input type="submit" value="Create User">
</form>
{% endif %}
{% endblock %}