<commit_before>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;
	}
}<commit_msg>Fix the session variable setting.<commit_after>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", userBean.getName());
	  			request.setAttribute("userBean", userBean);
	  			view = "welcome.jsp";
	  		}
	  	}
	  	
		return view;
	}
}
{'fraction_non_alphanumeric': 0.11745776347546259, 'fraction_numerical': 0.0, 'mean_word_length': 4.024242424242424, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5620600', 'n_tokens_mistral': 824, 'n_tokens_neox': 768, 'n_words': 146}