From 1cc8784b40b88d2043e992191c40ddc6b27f6d71 Mon Sep 17 00:00:00 2001 From: Connor L Jackson Date: Wed, 19 Apr 2017 14:30:53 -0400 Subject: [PATCH] New Users Can Be Created Now --- .../html/webpages/redirect/createProfile.jsp | 54 ++++++++++++ WebContent/html/webpages/userLogin.jsp | 83 +++++++++++++++++-- WebContent/index.jsp | 2 +- src/database/EmployeeQueries.java | 10 +++ 4 files changed, 141 insertions(+), 8 deletions(-) create mode 100644 WebContent/html/webpages/redirect/createProfile.jsp diff --git a/WebContent/html/webpages/redirect/createProfile.jsp b/WebContent/html/webpages/redirect/createProfile.jsp new file mode 100644 index 0000000..e3f9b4c --- /dev/null +++ b/WebContent/html/webpages/redirect/createProfile.jsp @@ -0,0 +1,54 @@ +<%@ page import = "database.*,entities.Device" %> +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + + + + + + + + + + Synchrony Financial + + + + + + + + +

Redirect Page

+

You shouldn't be seeing this page :)

+ +<% +//make instance +Cookie userCookie,newCookie; +String sso = request.getParameter("sso"); +String name = request.getParameter("name"); +String loc = request.getParameter("loc"); +String ph = request.getParameter("ph"); +String email = request.getParameter("email"); +//form was submitted +if(request.getParameter("submit") != null){ + EmployeeQueries.addEmployee(sso,loc,name,ph,email); + request.getSession(); + session.setAttribute("ssoNum", sso); + userCookie = new Cookie("ssoNum", sso); + userCookie.setMaxAge(30*60); + userCookie.setPath("/"); + response.addCookie(userCookie); + newCookie = new Cookie("name",name); + newCookie.setMaxAge(30*60); + newCookie.setPath("/"); + response.addCookie(newCookie); + response.sendRedirect("../index.jsp"); +} + +%> + + \ No newline at end of file diff --git a/WebContent/html/webpages/userLogin.jsp b/WebContent/html/webpages/userLogin.jsp index 3d5c2af..f3f35ff 100644 --- a/WebContent/html/webpages/userLogin.jsp +++ b/WebContent/html/webpages/userLogin.jsp @@ -1,7 +1,66 @@ -<%@ page import = "database.*" %> +<%@ page import = "database.*,entities.Location" %> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ page import = "java.sql.*" %> + + + + + + + + + + Synchrony Financial + + + + + + + + + + + + + + + <% Cookie userCookie,newCookie; @@ -29,11 +88,21 @@ if (result.next()){ response.addCookie(newCookie); stmt.close(); connection.close(); - response.sendRedirect("html/webpages/index.jsp"); -} else { - stmt.close(); - connection.close(); - response.sendRedirect("html/webpages/index.jsp"); + response.sendRedirect("index.jsp"); } +connection.close(); +stmt.close(); +String locations = Location.arrayToString(LocationQueries.getLocations(ssoNum)); +%> -%> \ No newline at end of file + \ No newline at end of file diff --git a/WebContent/index.jsp b/WebContent/index.jsp index a5d580e..7c4f219 100644 --- a/WebContent/index.jsp +++ b/WebContent/index.jsp @@ -94,7 +94,7 @@