@RequestMapping(value = {"/add", "/register"}, method = RequestMethod.POST)
    public String postAddUserForm(@ModelAttribute @Valid AddUserForm addUserForm, BindingResult result, Model model, HttpServletRequest request) {

        String uri = request.getServletPath();
        String origin = "";
        if("/user/add".equals(uri)) {
            origin = "add";
        } else if("/user/register".equals(uri)) {
            origin = "register";
        }

        model.addAttribute("origin", origin);

        convertPasswordError(result);

        if(result.hasErrors()) {
            return "user_add";
        }

        try {
            if(addUserForm.getUserRole() == null) {
                addUserForm.setUserRole(ROLE.ROLE_USER);
            }
            userDao.addUser(addUserForm.getUserName(), addUserForm.getPassword(), addUserForm.getUserRole());
        } catch(Exception e) {
            if(e.getCause().toString().contains("UNIQUE_SYS_USER_NAME")) {
                result.rejectValue("userName", "User name already taken.", "Sorry, the user name has been taken. Please try another one.");
            }
            return "user_add";
        }

        if("register".equals(origin)) {
            autoLogin(addUserForm.getUserName(), addUserForm.getPassword(), request);
        }

        model.asMap().remove("numOnline");
        return "redirect:" + userDao.getUserByName(addUserForm.getUserName()).getUser_id();
    }