protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
	{
		//Get register form data
		String firstname = request.getParameter("firstname");
		String lastname = request.getParameter("lastname");
		String email = request.getParameter("email");
		String password = request.getParameter("password");
	
	
		//Check database for duplicate email, i.e. account already exists
		boolean duplicateExists = regService.checkEmail(email);
		if (duplicateExists)
		{
			//If email already exists, return to register page with message
			request.setAttribute("failureMessage", "User with that email already registered.");
			request.getRequestDispatcher("register.jsp").forward(request, response);	
			return;
		}
		else
		{
			//Make new user
			try 
			{
				regService.createNewUser(email, firstname, lastname, SecurityUtils.sha1(password));
			} 
			catch (NoSuchAlgorithmException e) 
			{
				e.printStackTrace();
			}
			response.sendRedirect("login");	//Success, go to login page
			return;	
		}
		
				
	}