diff --git a/src/main/java/catering/users/UserController.java b/src/main/java/catering/users/UserController.java index eab74cc..c9cee89 100644 --- a/src/main/java/catering/users/UserController.java +++ b/src/main/java/catering/users/UserController.java @@ -74,13 +74,13 @@ public class UserController { userManagement.setPassword(password, user.getUserAccount()); } - userManagement.save(user); - - if (!username.isBlank()){ + if (username != userAccount.getUsername()){ + userManagement.save(user); return "redirect:/logout"; + } else { + userManagement.save(user); + return "redirect:/profile"; } - - return "redirect:/profile"; } @GetMapping("/profile/disable")