@RequestMapping(value = "/change/email", method = RequestMethod.POST) // add post when deployed
  public String changeEmail(
      HttpSession session, @RequestParam(value = "email") String email, ModelMap model)
      throws JSONException {
    String type = (String) session.getAttribute("type");
    if (type != null) {
      int id = (Integer) session.getAttribute("id");
      if (!userService.updateEmail(id, email, type)) {
        model.addAttribute("err", "Email already used");
      }
      ;
    }

    return "redirect:/dash";
  }