@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); }
@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); }
@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); }