@Override public void updatePasswordForUserAccount(final String username, final String password) { UserAccount userAccount = this.findUserAccountByUsername(username); PasswordEncoder encoder = new PasswordEncoder(); String encodedPassword = encoder.encodePassword(password, null); userAccount.setPassword(encodedPassword); this.updateUserAccount(userAccount); }
@Override public UserAccount createNewUserAccount(final UserAccount userAccount) { UserAccount deplicate = this.userAccountDao.findUserAccountByUsername(userAccount.getUsername()); if (deplicate != null) { throw new BusinessException("Username unavailable."); } PasswordEncoder encoder = new PasswordEncoder(); String encodedPassword = encoder.encodePassword(userAccount.getPassword(), null); userAccount.setPassword(encodedPassword); return this.userAccountDao.persist(userAccount); }