Florian du Garage Num cdb7028793 initial commit
2023-04-30 14:38:00 +02:00

70 lines
2.3 KiB
HTML

{% extends "base.html" %}
{% block content %}
<h2>User Management</h2>
<table class="table table-striped">
<thead>
<tr>
<th>Username</th>
<th>Email</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td>{{ user.username }}</td>
<td>{{ user.email }}</td>
<td>
<a href="{{ url_for('edit_user', user_id=user.id) }}" class="btn btn-primary btn-sm">Edit</a>
{% if not user.is_admin %}
{% if user.is_active %}
<a href="{{ url_for('block_user', user_id=user.id) }}" class="btn btn-warning btn-sm">Block</a>
{% else %}
<a href="{{ url_for('unblock_user', user_id=user.id) }}" class="btn btn-success btn-sm">Unblock</a>
{% endif %}
<a href="{{ url_for('delete_user', user_id=user.id) }}" class="btn btn-danger btn-sm">Delete</a>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="row">
<div class="col-md-6">
<h3>Create User</h3>
<form method="POST" action="{{ url_for('create_user') }}">
{{ form.csrf_token }}
<div class="form-group">
<label for="username">Username</label>
{{ form.username(class="form-control", placeholder="Enter username") }}
</div>
<div class="form-group">
<label for="email">Email</label>
{{ form.email(class="form-control", placeholder="Enter email address") }}
</div>
<div class="form-group">
<label for="password">Password</label>
{{ form.password(class="form-control", placeholder="Enter password") }}
</div>
<button type="submit" class="btn btn-primary">Create</button>
</form>
</div>
<div class="col-md-6">
<h3>Change Password</h3>
<form method="POST" action="{{ url_for('change_password') }}">
{{ form.csrf_token }}
<div class="form-group">
<label for="email">Email</label>
{{ form.email(class="form-control", placeholder="Enter email address") }}
</div>
<div class="form-group">
<label for="password">New Password</label>
{{ form.password(class="form-control", placeholder="Enter new password") }}
</div>
<button type="submit" class="btn btn-primary">Change</button>
</form>
</div>
</div>
{% endblock %}