Fix change-password dialog, user-edit for admin
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<div class="modal fade" id="userModal" tabindex="-1" aria-labelledby="userModalLabel" aria-hidden="true">
|
||||
<div class="modal fade" id="userModal{#if id}{id}{/if}" tabindex="-1" aria-labelledby="userModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
@@ -6,25 +6,37 @@
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
|
||||
<form action="/user/new" method="POST" name="userForm" enctype="multipart/form-data">
|
||||
<form action="/user/{#if update}update{#else}new{/if}" method="POST" name="userForm" enctype="multipart/form-data">
|
||||
<div class="modal-body row mb-3">
|
||||
<div class="align-items-center col-md-10 mx-auto col-lg-11">
|
||||
<div class="form-floating mb-3">
|
||||
<input type="text" name="username" class="form-control" id="name" placeholder="Benutzername" required>
|
||||
<input type="text" name="username" class="form-control" id="name" placeholder="Benutzername" required
|
||||
{#if update}readonly value="{user.username}"{/if}>
|
||||
<label for="name">Benutzername</label>
|
||||
</div>
|
||||
<div class="form-floating mb-3">
|
||||
<input type="password" name="password" class="form-control" id="pwd" placeholder="Password" required>
|
||||
<input type="password" name="password" class="form-control" id="pwd" placeholder="Password" required
|
||||
{#if update}disabled value="xxxxx"{/if}>
|
||||
<label for="pwd">Passwort</label>
|
||||
</div>
|
||||
<div class="form-floating mb-3">
|
||||
<input type="password" name="passwordVerify" class="form-control" id="pwdv" placeholder="Passwort wiederholen" required>
|
||||
<input type="password" name="passwordVerify" class="form-control" id="pwdv" placeholder="Passwort wiederholen" required
|
||||
{#if update}disabled value="xxxxx"{/if}>
|
||||
<label for="pwd">Passwort wiederholen</label>
|
||||
</div>
|
||||
<div class="form-floating mb-3">
|
||||
<select id="role" name="role" class="form-select" required>
|
||||
<option selected>USER</option>
|
||||
<option>ADMIN</option>
|
||||
<select id="room" name="room" class="form-select" required>
|
||||
<option value="">Bitte wählen...</option>
|
||||
{#for room in rooms}
|
||||
<option {user.selectedIfIn(room)}>{room.name}</option>
|
||||
{/for}
|
||||
</select>
|
||||
<label class="col-sm-3 col-form-label1" for="room">Raum</label>
|
||||
</div>
|
||||
<div class="form-floating mb-3">
|
||||
<select id="role" name="role" class="form-select" required {#if update}disabled{/if}>
|
||||
<option {#if update and user.hasRoleUser}selected{/if}>USER</option>
|
||||
<option {#if update and user.hasRoleAdmin}selected{/if}>ADMIN</option>
|
||||
</select>
|
||||
<label class="col-sm-3 col-form-label1" for="role">Rolle</label>
|
||||
</div>
|
||||
|
||||
@@ -4,7 +4,33 @@
|
||||
|
||||
<div class="mt-2">
|
||||
<h2>Hallo {current_username}</h2>
|
||||
{#if is_admin}User: {user_count}{/if}
|
||||
{#if is_admin}
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Username</th>
|
||||
<th scope="col">Raum</th>
|
||||
<th scope="col"/>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#for user in users}
|
||||
<tr>
|
||||
<td>
|
||||
{user.username}
|
||||
</td>
|
||||
<td>
|
||||
{user.room.name}
|
||||
</td>
|
||||
<td style="width:1px; white-space:nowrap;">
|
||||
<a class="btn btn-primary btn-sm" data-bs-toggle="modal" data-bs-target="#userModal{count}" role="button">Edit</a>
|
||||
{#include user-modal.html rooms=rooms update=true id=count user=user}{/include}
|
||||
</td>
|
||||
</tr>
|
||||
{/for}
|
||||
</tbody>
|
||||
</table>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="mt-2" >
|
||||
@@ -13,7 +39,7 @@
|
||||
{/if}
|
||||
<a class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#passwordModal" role="button">Passwort ändern</a>
|
||||
{#if is_admin}
|
||||
{#include user-modal.html}{/include}
|
||||
{#include user-modal.html rooms=rooms}{/include}
|
||||
{/if}
|
||||
{#include password-modal.html}{/include}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user