diff --git a/src/main/java/ru/redrise/marinesco/UserGenerified.java b/src/main/java/ru/redrise/marinesco/UserGenerified.java index c7745d5..5d22146 100644 --- a/src/main/java/ru/redrise/marinesco/UserGenerified.java +++ b/src/main/java/ru/redrise/marinesco/UserGenerified.java @@ -19,6 +19,7 @@ public class UserGenerified { private String displayName; private List athorities; private List athoritiesLost; + private String password; public UserGenerified(User user, List allRolesList){ this.id = user.getId(); diff --git a/src/main/java/ru/redrise/marinesco/security/ManageUsersController.java b/src/main/java/ru/redrise/marinesco/security/ManageUsersController.java index 0bc804d..4ce1e07 100644 --- a/src/main/java/ru/redrise/marinesco/security/ManageUsersController.java +++ b/src/main/java/ru/redrise/marinesco/security/ManageUsersController.java @@ -87,13 +87,16 @@ public class ManageUsersController { } @PostMapping("/update") - public String updateRoles(UserGenerified userGenerified) { + public String update(UserGenerified userGenerified) { User user = userRepository.findById(userGenerified.getId()).get(); if (user == null) return "redirect:/manage_users"; user.setAuthorities(userGenerified.getAthorities()); user.setDisplayname(userGenerified.getDisplayName()); + String password = userGenerified.getPassword().trim(); + if (! password.trim().isEmpty()) + user.setPassword(passwordEncoder.encode(userGenerified.getPassword())); userRepository.save(user); return "redirect:/manage_users"; diff --git a/src/main/java/ru/redrise/marinesco/security/RegistrationController.java b/src/main/java/ru/redrise/marinesco/security/RegistrationController.java index 9bd1a8e..75578c6 100644 --- a/src/main/java/ru/redrise/marinesco/security/RegistrationController.java +++ b/src/main/java/ru/redrise/marinesco/security/RegistrationController.java @@ -16,7 +16,6 @@ import ru.redrise.marinesco.User; import ru.redrise.marinesco.data.RolesRepository; import ru.redrise.marinesco.data.UserRepository; import ru.redrise.marinesco.settings.ApplicationSettings; -import ru.redrise.marinesco.settings.KeyValueRepository; @Slf4j @Controller diff --git a/src/main/resources/templates/manage_users.html b/src/main/resources/templates/manage_users.html index e8212c4..fb16a3d 100644 --- a/src/main/resources/templates/manage_users.html +++ b/src/main/resources/templates/manage_users.html @@ -4,7 +4,7 @@ Marinesco - Manage users - + @@ -21,8 +21,12 @@
- Display name: + Display name: +

+ Password: + +



Roles:
@@ -62,7 +66,8 @@
Roles:
- +