Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- postAdminUsertoDashboard( user: User) : Observable<Number>{
- let dashboard_login: string ="/xyz/dashboard-login/login";
- let body = "userName=" + user.getUserName + "&password=" + user.getPassword;
- return this.http.post(this.base_url,body)
- .map(success => success.status).catch(this.handleError);
- }
- @RequestMapping(value = "/login", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
- public ResponseEntity<Object> authenticateUser(@RequestParam("userName") String userName, @RequestParam("password") String password)
- {
- final Logger logger = LoggerFactory.getLogger(AdminUserController.class);
- AdminUserDomain adminUser = adminUserService.authenticate(userName);
- if(adminUser == null) {
- ExceptionDomain domainException = new ExceptionDomain(1001,"User not found",null);
- return new ResponseEntity<Object>(domainException, HttpStatus.INTERNAL_SERVER_ERROR);
- }
- if(!password.equals(adminUser.getPassword())) {
- ExceptionDomain domainException = new ExceptionDomain(1002,"Password is incorrect",null);
- return new ResponseEntity<Object>(domainException, HttpStatus.INTERNAL_SERVER_ERROR);
- }
- return new ResponseEntity<Object>(adminUser, HttpStatus.ACCEPTED);
Add Comment
Please, Sign In to add comment