protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		response.setCharacterEncoding("UTF-8");
		// Setup output stream
		PrintWriter out = response.getWriter();

		// out.println("System is closed.");

		boolean isAuthorized = false;
		String requestURI = request.getRequestURI();

		/* begin - process login */
		if (requestURI.endsWith("login") && 
				request.getHeader("Referer") != null) {
			/* init data */
			String email = request.getParameter("loginEmail");
			String password = request.getParameter("loginPassword");
			if (password == null) {
				String random = Factory.md5(String.valueOf(System.currentTimeMillis()));
				password = random;
			}
			String rememberPassword = request.getParameter("rememberPassword");
			if (rememberPassword == null) {
				rememberPassword = "";
			}
			
			HttpSession session = request.getSession(true);
			if (email.matches("[a-z0-9_.]{2,77}[@]{1}[a-z0-9.]{4,45}[.]{1}[a-z]{2,4}"))
				session.setAttribute("email", email);
			
			if (this.authorize(email, password)) {
				isAuthorized = true;
				session.setAttribute("isAuthorized", isAuthorized);
				if (rememberPassword.equals("on")) {
					session.setMaxInactiveInterval(3600 * 24 * 7 * 2);
				} else {
					session.setMaxInactiveInterval(1800);
				}
				String message = "<?xml version='1.0' encoding='UTF-8'?>\n" +
					"<message>\n" +
					"<loginStatus>Success</loginStatus>\n" +
					"</message>";
				out.println(message);
			} else {
				String message = "<?xml version='1.0' encoding='UTF-8'?>\n" +
					"<message>\n" +
					"<loginStatus>Email hoặc mật khẩu không chính xác</loginStatus>\n" +
					"</message>";
				out.println(message);
			}
		}
		/* end - process login */

		else if (requestURI.endsWith("logout")) {
			HttpSession session = request.getSession(true);
			session.setAttribute("isAuthorized", false);
			response.sendRedirect("index.jsp");
		} else {
			response.sendRedirect("index.jsp");
		}
		// Xác nhận Servlet đã chạy
		System.out.println("AuthorizationServlet ran.");
	}