createUser(username, password, name, email, createDashBoDashboard());
logger.info("Registered new user[" + username + "]");
}
protected UserDetails createUser(String username, String password, String name, String email, Dashboard dashboard) {
Authority authority = Authority.findByName(Authority.ROLE_USER);
UserDetails user = new UserDetails();
user.setSalt(salt);
user.setName(name);
user.setEmail(email);
user.setUsername(username);
user.setPassword(password);
user.setDashboard(dashboard);
user.setEnabled(Boolean.TRUE);
user.getRoles().add(authority);
authority.getUsers().add(user);
user.persist();
adminService.createPayee(user, user.getName());
createSubcategories(user);
user.setBudget(createBudget(user));
if (createBasicSpanishFinancialInstitutions) {
createBasicSpanishInstitutions(user);
}
authority.merge();
user.merge();
return user;
}