public void changePassword(String password) { User currentUser = userRepository.findOneByLogin(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, String langKey) { User currentUser = userRepository.findOneByLogin(SecurityUtils.getCurrentLogin()); currentUser.setFirstName(firstName); currentUser.setLastName(lastName); currentUser.setEmail(email); currentUser.setLangKey(langKey); userRepository.save(currentUser); log.debug("Changed Information for User: {}", currentUser); }
@Transactional(readOnly = true) public User getUserWithAuthorities() { User currentUser = userRepository.findOneByLogin(SecurityUtils.getCurrentLogin()); currentUser.getAuthorities().size(); // eagerly load the association return currentUser; }