package com.ticktac.utils;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ticktac.business.User;
import com.ticktac.data.UserDAO;

public class LogInRequestHandler implements RequestHandler {
	UserDAO userDAO;
	
	public LogInRequestHandler() {
		userDAO = new UserDAO();
	}
	
	public String handleRequest(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String view = "";
	  	String email = (String)request.getParameter("email");
	  	String password = (String)request.getParameter("password");
	  	
	  	if(email == null || password == null)
	  		view = "login.jsp";
	  	else {
	  		User userBean = userDAO.searchUser(email, password);
	  		if(userBean == null) {
	  			request.getServletContext().setAttribute("accountExists", false);
	  			view = "login.jsp";
	  		}
	  		else {
	  			request.setAttribute("accountExists", true);
	  			request.getSession().setAttribute("user", request.getParameter(userBean.getName()));
	  			request.setAttribute("userBean", userBean);
	  			view = "welcome.jsp";
	  		}
	  	}
	  	
		return view;
	}
}

@@ -1052,37 +1052,16 @@
 %22user%22, 
-request.getParameter(
 userBean
@@ -1071,17 +1071,16 @@
 tName())
-)
 ;%0A%09  %09%09%09

Fix the session variable setting.