public void changePassword(String password) { User currentUser = userRepository.findOne(SecurityUtils.getCurrentLogin()); String encryptedPassword = passwordEncoder.encode(password); currentUser.setPassword(encryptedPassword); userRepository.save(currentUser); log.debug("Changed password for User: {}", currentUser); }
public void updateUserInformation(String firstName, String lastName, String email) { User currentUser = userRepository.findOne(SecurityUtils.getCurrentLogin()); currentUser.setFirstName(firstName); currentUser.setLastName(lastName); currentUser.setEmail(email); userRepository.save(currentUser); log.debug("Changed Information for User: {}", currentUser); }
@Transactional(readOnly = true) public User getUserWithAuthorities() { User currentUser = userRepository.findOne(SecurityUtils.getCurrentLogin()); currentUser.getAuthorities().size(); // eagerly load the association return currentUser; }