Logout user if changing their own username

Closes #45
This commit is contained in:
Denis Natusch 2023-11-19 13:08:30 +01:00
parent 244b5a9a74
commit 506824a8b7
No known key found for this signature in database
GPG key ID: 5E57BD8EDACFA985

View file

@ -74,13 +74,13 @@ public class UserController {
userManagement.setPassword(password, user.getUserAccount()); userManagement.setPassword(password, user.getUserAccount());
} }
userManagement.save(user); if (username != userAccount.getUsername()){
userManagement.save(user);
if (!username.isBlank()){
return "redirect:/logout"; return "redirect:/logout";
} else {
userManagement.save(user);
return "redirect:/profile";
} }
return "redirect:/profile";
} }
@GetMapping("/profile/disable") @GetMapping("/profile/disable")