// need this to be a separate url while we're in private alpha @RequestMapping(value = "/home") public ModelAndView loadHome(HttpServletRequest req, HttpServletResponse res) { ModelAndView modelAndView = new ModelAndView("home"); User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); // this is necessary b/c of hibernate lazy loading weirdness user = userService.getUserById(user.getId()); modelAndView.addObject("user", user); return modelAndView; }
@Transactional public String createUser(User user) { if (user.getEmail() != null) { user.setPassword(createHash(user.getPassword())); user.fullyEnable(); userDAO.saveUser(user); user.getInvite().setStatus(InviteStatus.USED); user.getInvite().setDateUpdated(new DateTime()); userDAO.updateInvite(user.getInvite()); } return "success"; }
@Transactional public void updatePassword(User user, String password) { user.setPassword(createHash(password)); userDAO.saveOrUpdateUser(user); }