Beispiel #1
0
  @RequestMapping(value = "{id}", method = RequestMethod.PUT)
  public String update(@LoginUser SocialUser loginUser, @PathVariable Long id, UserForm userForm)
      throws Exception {
    SocialUser socialUser = userService.findById(id);
    if (!loginUser.isSameUser(socialUser)) {
      throw new IllegalArgumentException("You cann't change another user!");
    }

    userService.updateSlippUser(loginUser, userForm.getEmail(), userForm.getUserId());

    return "redirect:/users/logout";
  }
Beispiel #2
0
 @RequestMapping(value = "", method = RequestMethod.POST)
 public String create(UserForm user, HttpServletRequest request, HttpServletResponse response) {
   SocialUser socialUser = userService.createSlippUser(user.getUserId(), user.getEmail());
   autoLoginAuthenticator.login(socialUser.getEmail(), socialUser.getRawPassword());
   return "redirect:/";
 }