2023-08-13 02:12:29 +02:00
<!DOCTYPE html>
2024-03-21 21:58:01 +01:00
< html th:lang = "${#locale.language}" th:dir = "#{language.direction}" th:data-language = "${#locale.toString()}" xmlns:th = "http://www.thymeleaf.org" >
2024-02-16 22:49:06 +01:00
< head >
< th:block th:insert = "~{fragments/common :: head(title=#{adminUserSettings.title}, header=#{adminUserSettings.header})}" > < / th:block >
< / head >
2023-08-13 02:12:29 +02:00
2024-02-16 22:49:06 +01:00
< body >
2023-08-13 02:12:29 +02:00
< th:block th:insert = "~{fragments/common :: game}" > < / th:block >
< div id = "page-container" >
2024-02-16 22:49:06 +01:00
< div id = "content-wrap" >
< th:block th:insert = "~{fragments/navbar.html :: navbar}" > < / th:block >
2024-03-21 21:58:01 +01:00
< br > < br >
2024-02-16 22:49:06 +01:00
< div class = "container" >
< div class = "row justify-content-center" >
< div class = "col-md-8" >
2024-02-11 17:47:00 +01:00
2024-02-16 22:49:06 +01:00
<!-- User Settings Title -->
< h2 class = "text-center" th:text = "#{adminUserSettings.header}" > Admin User Control Settings< / h2 >
2024-03-06 23:14:02 +01:00
< div th:if = "${param.messageType != null and param.messageType.size() > 0 and (param.messageType[0] == 'deleteCurrentUser' or param.messageType[0] == 'deleteUsernameExists')}" class = "alert alert-danger" >
< span th:if = "${param.messageType[0] == 'deleteCurrentUser'}" th:text = "#{deleteCurrentUserMessage}" > Cannot delete currently logged in user.< / span >
< span th:if = "${param.messageType[0] == 'deleteUsernameExists'}" th:text = "#{deleteUsernameExistsMessage}" > The username does not exist and cannot be deleted.< / span >
< / div >
2024-02-16 22:49:06 +01:00
< table class = "table" >
< thead >
< tr >
< th th:text = "#{username}" > Username< / th >
< th th:text = "#{adminUserSettings.roles}" > Roles< / th >
2024-03-21 21:58:01 +01:00
< th th:text = "#{adminUserSettings.actions}" > Actions< / th >
2024-02-16 22:49:06 +01:00
< / tr >
< / thead >
< tbody >
< tr th:each = "user : ${users}" >
< td th:text = "${user.username}" > < / td >
2024-03-06 23:14:02 +01:00
< td th:text = "#{${user.roleName}}" > < / td >
2024-02-16 22:49:06 +01:00
< td >
< form th:if = "${user.username != currentUsername}" th:action = "@{'/api/v1/user/admin/deleteUser/' + ${user.username}}" method = "post" >
< button type = "submit" th:text = "#{delete}" > Delete< / button >
< / form >
< / td >
< / tr >
< / tbody >
< / table >
2023-08-13 02:12:29 +02:00
2024-02-16 22:49:06 +01:00
< h2 th:text = "#{adminUserSettings.addUser}" > Add New User< / h2 >
2024-03-13 23:09:16 +01:00
< div th:if = "${param.messageType != null and param.messageType.size() > 0 and (param.messageType[0] == 'usernameExists' or param.messageType[0] == 'invalidUsername')}" class = "alert alert-danger" >
< span th:if = "${param.messageType[0] == 'usernameExists'}" th:text = "#{usernameExistsMessage}" > Default message if not found< / span >
< span th:if = "${param.messageType[0] == 'invalidUsername'}" th:text = "#{invalidUsernameMessage}" > Default message if not found< / span >
2024-02-16 22:49:06 +01:00
< / div >
< form action = "/api/v1/user/admin/saveUser" method = "post" >
< div class = "mb-3" >
< label for = "username" th:text = "#{username}" > Username< / label >
2024-03-13 23:09:16 +01:00
< input type = "text" class = "form-control" name = "username" pattern = "[a-zA-Z0-9]+" th:title = "#{adminUserSettings.usernameInfo}" required >
2024-02-16 22:49:06 +01:00
< / div >
< div class = "mb-3" >
< label for = "password" th:text = "#{password}" > Password< / label >
< input type = "password" class = "form-control" name = "password" required >
< / div >
< div class = "mb-3" >
< label for = "role" th:text = "#{adminUserSettings.role}" > Role< / label >
< select name = "role" class = "form-control" required >
2024-03-06 23:14:02 +01:00
< option th:each = "roleDetail : ${roleDetails}" th:value = "${roleDetail.key}" th:text = "#{${roleDetail.value}}" > Role< / option >
2024-02-16 22:49:06 +01:00
< / select >
< / div >
< div class = "mb-3" >
< input type = "checkbox" class = "form-check-input" id = "forceChange" name = "forceChange" >
< label class = "form-check-label" for = "forceChange" th:text = "#{adminUserSettings.forceChange}" > Force user to change username/password on login< / label >
2023-08-13 02:12:29 +02:00
< / div >
2024-02-16 22:49:06 +01:00
<!-- Add other fields as required -->
< button type = "submit" class = "btn btn-primary" th:text = "#{adminUserSettings.submit}" > Save User< / button >
< / form >
< / div >
< / div >
2023-08-13 02:12:29 +02:00
< / div >
2024-02-16 22:49:06 +01:00
< / div >
< th:block th:insert = "~{fragments/footer.html :: footer}" > < / th:block >
2023-08-13 02:12:29 +02:00
< / div >
2024-02-16 22:49:06 +01:00
< / body >
2024-03-21 21:58:01 +01:00
< / html >