コード例 #1
0
 @RequestMapping(
     value = "/login",
     method = RequestMethod.POST,
     consumes = {"application/json"})
 @ResponseBody
 public ResponseEntity<User> LoginUser(@RequestBody User user) {
   User newUser = userDao.login(user.getUserName(), user.getUserPassword());
   if (newUser == null) return new ResponseEntity<User>(newUser, HttpStatus.BAD_REQUEST);
   return new ResponseEntity<User>(newUser, HttpStatus.OK);
 }
コード例 #2
0
 @RequestMapping(
     value = "/update/info/{username}",
     method = RequestMethod.POST,
     consumes = {"application/json"})
 @ResponseBody
 public ResponseEntity<User> UpdateInfo(
     @RequestBody User user, @PathVariable("username") String username) {
   User newUser = userDao.updateInfo(user.getUserEmail(), user.getUserPhoneNumber());
   if (newUser == null) return new ResponseEntity<User>(newUser, HttpStatus.NOT_FOUND);
   return new ResponseEntity<User>(newUser, HttpStatus.OK);
 }
コード例 #3
0
 @RequestMapping(
     value = "/forgotpassword",
     method = RequestMethod.POST,
     consumes = {"application/json"})
 @ResponseBody
 public ResponseEntity<User> ForgotPassword(@RequestBody User userEmail) {
   User user = userDao.createToken(userEmail.getUserEmail());
   if (user == null) return new ResponseEntity<User>(HttpStatus.NOT_FOUND);
   sendGetPasswordMail(user.getUserName(), user.getUserEmail());
   return new ResponseEntity<User>(user, HttpStatus.OK);
 }
コード例 #4
0
 @RequestMapping(
     value = "/update/token/{token}",
     method = RequestMethod.POST,
     consumes = {"application/json"})
 @ResponseBody
 public ResponseEntity<User> UpdateUserPassword(
     @RequestBody User user, @PathVariable("token") String token) {
   User reUser = userDao.updateUserPassword(user.getUserName(), user.getUserPassword(), token);
   if (reUser == null) return new ResponseEntity<User>(reUser, HttpStatus.NOT_FOUND);
   return new ResponseEntity<User>(reUser, HttpStatus.OK);
 }
コード例 #5
0
 @RequestMapping(
     value = "/new",
     method = RequestMethod.POST,
     consumes = {"application/json"})
 @ResponseBody
 public ResponseEntity<User> AddUser(@RequestBody User user) {
   User newUser =
       userDao.createNewUser(user.getUserName(), user.getUserEmail(), user.getUserPassword(), 3);
   if (newUser != null) {
     sendConfirmationMail(newUser.getUserName(), newUser.getUserEmail());
     return new ResponseEntity<User>(newUser, HttpStatus.OK);
   } else return new ResponseEntity<User>(HttpStatus.CONFLICT);
 }