Updated the login check from JSP to controller.