@RequestMapping(
      value = "/dashboard/updateuser",
      method = RequestMethod.POST,
      produces = MediaType.APPLICATION_JSON_VALUE,
      consumes = MediaType.APPLICATION_JSON_VALUE)
  public @ResponseBody String updateUserProfile(
      @RequestBody String contactObjectJSON, ModelMap model, HttpServletRequest request) {

    logger.info("Updating User Profile for JSON" + contactObjectJSON);

    if (filter.isUserSessionExpired(request, encoder)) {
      return "You session has expired. Please login again to proceed!!";
    }

    Contact contact = null;
    try {
      contact = Utils.getContactObjectFromJSON(contactObjectJSON);

      logger.info("Updating User Profile for username = "******"Error in updating user details in database.";
    }
    model.addAttribute("command", contact);
    return "true";
  }
  @RequestMapping(
      value = "/dashboard/updatepassword",
      method = RequestMethod.POST,
      produces = MediaType.APPLICATION_JSON_VALUE,
      consumes = MediaType.APPLICATION_JSON_VALUE)
  @ResponseBody
  public boolean updatePassword(@RequestBody String passwordsJSON) {
    logger.info("Updating User Passwords for JSON" + passwordsJSON);

    try {

      String passwords[] = Utils.getPasswordsFromJSON(passwordsJSON);
      logger.info("Passwords received : " + Arrays.toString(passwords));
      // check if user is login
      Authentication auth = SecurityContextHolder.getContext().getAuthentication();

      if (auth instanceof UsernamePasswordAuthenticationToken) {
        UserDetails userDetail = (UserDetails) auth.getPrincipal();
        logger.debug("Processing for user's details: " + userDetail);

        String username = userDetail.getUsername();
        logger.info("Username taken from SecurityContext " + username);
        User user = userService.getUserByUsername(username);

        //				mdPassEncoder.isPasswordValid(user.getPassword(), passwords[0], user.getSalt())){
        //				BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
        //				mdPassEncoder.encodePassword(passwords[1], salt));

        if (user != null) {
          if (user.getPassword() != null && encoder.matches(passwords[0], user.getPassword())) {

            //						String salt = String.valueOf(Utils.getSalt());
            //						user.setSalt(salt);

            user.setPassword(encoder.encode(passwords[1]));
            userService.create(user);
          } else {
            return false;
          }
        }
      }

    } catch (Exception e) {
      logger.error(Utils.getStackTrace(e.fillInStackTrace()));
      return false;
    }
    return true;
  }