Ignore:
Timestamp:
01/05/22 15:57:29 (2 years ago)
Author:
NikolaCenevski <cenevskinikola@…>
Branches:
master
Children:
6fa3d09
Parents:
881a233
Message:

part 2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/it/finki/charitable/controller/UserProfileController.java

    r881a233 rb8dc761  
    115115            fundsCollectedService.save(funds);
    116116            post.getFundsCollected().add(funds);
     117            post.setTotalFundsCollected(post.getTotalFundsCollected() + amount);
    117118            donationPostService.save(post);
    118119        }
     
    122123    @ModelAttribute("user")
    123124    public AppUser addAttributes() {
    124         if(SecurityContextHolder.getContext().getAuthentication().getPrincipal() != "anonymousUser") {
    125             return (AppUser) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
     125        if (SecurityContextHolder.getContext().getAuthentication().getPrincipal() != "anonymousUser") {
     126
     127            String email = SecurityContextHolder.getContext().getAuthentication().getName();
     128            return userService.loadUserByUsername(email);
    126129        }
    127130        return null;
Note: See TracChangeset for help on using the changeset viewer.