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,14 +74,14 @@ public class UserController {
userManagement.setPassword(password, user.getUserAccount());
}
if (username != userAccount.getUsername()){
userManagement.save(user);
if (!username.isBlank()){
return "redirect:/logout";
}
} else {
userManagement.save(user);
return "redirect:/profile";
}
}
@GetMapping("/profile/disable")
@PreAuthorize("hasRole('CUSTOMER')")