// -------------------------------------------------accounts--------------------------------------------------------- @RequestMapping(value = "/account", method = RequestMethod.PUT) public ResponseEntity createAccount(@RequestBody RestUserAccountModel userAccountModel) { return new ResponseEntity<>( userAccountBo.createNativeAccount(userAccountModel) ? HttpStatus.OK : HttpStatus.BAD_REQUEST); }
@RequestMapping(value = "/login/restore", method = RequestMethod.POST) public ResponseEntity restorePassword(@RequestBody Map<String, String> emailMap) { return new ResponseEntity( userAccountBo.restorePassword(emailMap.get(EMAIL)) ? HttpStatus.OK : HttpStatus.BAD_REQUEST); }
// -------------------------------------------------login------------------------------------------------------------ @RequestMapping(value = "/login/native", method = RequestMethod.POST) public ResponseEntity loginNative(@RequestBody Map<String, String> loginInfoMap) { final String token = userAccountBo.loginNative(loginInfoMap.get(EMAIL), loginInfoMap.get(PASSWORD)); Map<String, String> map = new HashMap<>(1); map.put(TOKEN, token); return token != null ? new ResponseEntity<>(map, HttpStatus.OK) : new ResponseEntity(HttpStatus.BAD_REQUEST); }
@RequestMapping(value = "/login/social", method = RequestMethod.POST) public ResponseEntity loginSocial(@RequestBody Map<String, String> loginInfoMap) { final String token = userAccountBo.loginSocial( loginInfoMap.get(SOCIAL_NETWORK), loginInfoMap.get(AUTH_DATA), loginInfoMap.get(USER_CATEGORY)); Map<String, String> map = new HashMap<>(1); map.put(TOKEN, token); return token != null ? new ResponseEntity<>(map, HttpStatus.OK) : new ResponseEntity(HttpStatus.BAD_REQUEST); }
@RequestMapping(value = "/login/logout", method = RequestMethod.POST) public ResponseEntity logout(@RequestHeader(TOKEN) String token) { return new ResponseEntity( userAccountBo.logout(token) ? HttpStatus.OK : HttpStatus.UNAUTHORIZED); }