コード例 #1
0
ファイル: UsersController.java プロジェクト: rockyruah/slipp
  @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";
  }
コード例 #2
0
ファイル: UsersController.java プロジェクト: rockyruah/slipp
 @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:/";
 }