@RequestMapping(value = "/register", method = RequestMethod.POST)
	public @ResponseBody
	HashMap<String, Object> registerUser(@RequestBody User user)
			throws EmailOrLoginUsedException {
		logger.info("new user");
		HashMap<String, Object> resultHashMap = new HashMap<String, Object>();
		if (user.getFirstName().length() < 2)
			resultHashMap.put("firstNameError", "First name is too short.");
		if (user.getLastName().length() < 2)
			resultHashMap.put("lastNameError", "Last name is too short.");
		if (user.getPassword().length() < 7)
			resultHashMap.put("passwordError", "Password is too short.");
		Pattern emailPattern = Pattern.compile("^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"
				+ "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$");
		Matcher m = emailPattern.matcher(user.getEmail());
		if (!m.matches())
			resultHashMap.put("emailError", "Email address is invalid.");
		if (user.getUsername().length() < 2)
			resultHashMap.put("username", "Username is too short.");
		resultHashMap.put("isRegister",
				userRepository.register(user));

		return resultHashMap;
	}