Remove redundant code from viewProfile method

This commit is contained in:
Denis Natusch 2023-12-14 09:53:14 +01:00
parent b0279a5c78
commit 5736b49080
No known key found for this signature in database
GPG key ID: 5E57BD8EDACFA985

View file

@ -69,9 +69,6 @@ public class UserController {
@GetMapping("/profile") @GetMapping("/profile")
@PreAuthorize("isAuthenticated()") @PreAuthorize("isAuthenticated()")
public String viewProfile(Model model, @LoggedIn UserAccount userAccount) { public String viewProfile(Model model, @LoggedIn UserAccount userAccount) {
if (userAccount == null) {
return "redirect:/";
}
User user = userManagement.getUserByAccount(userAccount).get(); User user = userManagement.getUserByAccount(userAccount).get();
model.addAttribute("profileForm", new ProfileForm(user.getUsername(), user.getAddress(), user.getFullName(), "")); model.addAttribute("profileForm", new ProfileForm(user.getUsername(), user.getAddress(), user.getFullName(), ""));
return "profile"; return "profile";