/** * @param user * @return */ public User registerNewUser(final User user) { boolean registered = isUserAlreadyRegistered(user); user.setPassword(pwdEncoder.encode(user.getPassword())); if (registered) { return null; } userProfileDAO.registerUser(user); User newUser = loginDAO.findByEmailId(user.getEmailId()); return newUser; }
public boolean isUserAlreadyRegistered(User user) { User newUser = loginDAO.findByEmailId(user.getEmailId()); return newUser == null ? false : true; }