예제 #1
0
  @RequestMapping(
      value = "/doLogin",
      method = RequestMethod.POST,
      produces = "application/json; charset=UTF-8")
  public @ResponseBody String dologin(Model model, HttpServletRequest req, HttpSession session) {
    String email = req.getParameter("email");
    String pass = req.getParameter("password");
    String nextUri = req.getParameter("nextUri");

    if (nextUri.length() == 0) {

      nextUri = req.getContextPath() + "/";
    }

    UserVO user = userService.findUser(email, pass);
    if (user != null) {
      session.removeAttribute("nextUri");
    } else {;
    }
    System.out.println("로긴: " + user.toString());

    session.setAttribute("user", user);

    return "{\"success\": true , \"nextUri\": \"" + nextUri + "\"}";
  }
예제 #2
0
  @RequestMapping(
      value = "/doJoin",
      method = RequestMethod.POST,
      produces = "application/json; charset=UTF-8")
  public @ResponseBody String doJoin(Model model, HttpServletRequest req) {
    String email = req.getParameter("email");
    String pass = req.getParameter("password");
    String name = req.getParameter("name");
    String phonenumber = req.getParameter("phonenumber");

    UserVO user = userService.insertUser(email, pass, name, phonenumber);
    System.out.println("가입: " + user.toString());

    // json 포맷으로 응답을 보내야 합니다. { "success" : true}
    return "{\"success\": true}";
  }