login method skeleton

This commit is contained in:
Marcin Michałek committed 2014-05-09 15:37:34 +02:00
1 parent 2df87040ed
commit 636b1d8a72
2 files changed
+41 -8

No files matched your search

@@ -10,10 +10,7 @@ import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
@@ -47,6 +44,16 @@ public class UserController {
return "saved user: "+user.getUserId();
}
@RequestMapping(value = "/login", method = RequestMethod.POST)
@ResponseBody
public String login(@RequestParam String login,@RequestParam String password) throws JSONException{
// test
JSONObject test = new JSONObject();
test.put("success", true);
return test.toString();
}
@RequestMapping("/{userId}")
public String getUser(@PathVariable("userId") Long userId) throws JSONException{
User user = userRepository.findOne(userId);