コード例 #1
0
ファイル: UsersController.java プロジェクト: rockyruah/slipp
  @RequestMapping("{id}/form")
  public String updateForm(@LoginUser SocialUser loginUser, @PathVariable Long id, Model model)
      throws Exception {
    SocialUser socialUser = userService.findById(id);
    if (!loginUser.isSameUser(socialUser)) {
      throw new IllegalArgumentException("You cann't change another user!");
    }

    model.addAttribute("user", new UserForm(socialUser.getUserId(), socialUser.getEmail()));
    model.addAttribute("socialUser", socialUser);
    return "users/form";
  }
コード例 #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:/";
 }