From 146a0b6b7a77c7632abc11fd598fc5afc205f549 Mon Sep 17 00:00:00 2001 From: Connor L Jackson Date: Wed, 12 Apr 2017 22:48:16 -0400 Subject: [PATCH 1/5] Removing buggy script --- WebContent/html/webpages/returnPage.jsp | 2 -- 1 file changed, 2 deletions(-) diff --git a/WebContent/html/webpages/returnPage.jsp b/WebContent/html/webpages/returnPage.jsp index 00c03bc..6d85190 100644 --- a/WebContent/html/webpages/returnPage.jsp +++ b/WebContent/html/webpages/returnPage.jsp @@ -12,8 +12,6 @@ Synchrony Financial - - From a792c6fb4906cf1c6e113165a4bfcbd99e308000 Mon Sep 17 00:00:00 2001 From: Connor L Jackson Date: Thu, 13 Apr 2017 13:15:14 -0400 Subject: [PATCH 2/5] Logout Button Is Functional That was NOT fun. --- WebContent/html/webpages/adminApprove.jsp | 5 ++++ WebContent/html/webpages/logout.jsp | 22 ++++++++++++++ WebContent/html/webpages/logoutPage.jsp | 36 +++++++++++++++++++++++ WebContent/html/webpages/navbar.jsp | 16 ++++++---- WebContent/index.jsp | 14 ++++----- WebContent/userLogin.jsp | 3 +- 6 files changed, 80 insertions(+), 16 deletions(-) create mode 100644 WebContent/html/webpages/logout.jsp create mode 100644 WebContent/html/webpages/logoutPage.jsp diff --git a/WebContent/html/webpages/adminApprove.jsp b/WebContent/html/webpages/adminApprove.jsp index 773165c..6c999ef 100644 --- a/WebContent/html/webpages/adminApprove.jsp +++ b/WebContent/html/webpages/adminApprove.jsp @@ -71,11 +71,16 @@ .table{ width: auto; background-color: #E9EAEB; + margin: 0 auto; } tbody{ text-align: left; } + + .btn{ + margin-top: 15px; + } diff --git a/WebContent/html/webpages/logout.jsp b/WebContent/html/webpages/logout.jsp new file mode 100644 index 0000000..1d7cba8 --- /dev/null +++ b/WebContent/html/webpages/logout.jsp @@ -0,0 +1,22 @@ +<%@ page import = "database.*" %> +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> +<%@ page import = "java.sql.*" %> + +<% +Cookie[] usercookies = request.getCookies(); +if(usercookies != null){ + for(Cookie c : usercookies){ + if(c.getName().equals("ssoNum")){//when (and if) we get to user cookie we want to reset it + c.setMaxAge(0);//delete current + Cookie newCookie = new Cookie("ssoNum","");//make new one + newCookie.setMaxAge(0); + newCookie.setPath("/"); + response.addCookie(newCookie); + break; + } + } +} +response.sendRedirect("index.jsp"); +return; +%> \ No newline at end of file diff --git a/WebContent/html/webpages/logoutPage.jsp b/WebContent/html/webpages/logoutPage.jsp new file mode 100644 index 0000000..1161ef7 --- /dev/null +++ b/WebContent/html/webpages/logoutPage.jsp @@ -0,0 +1,36 @@ + + + + + + + + + + + Synchrony Financial + + + + + + + + + + +
+

You Have Logged Out.

+ +
+ + \ No newline at end of file diff --git a/WebContent/html/webpages/navbar.jsp b/WebContent/html/webpages/navbar.jsp index ab4cbb2..8d1a49d 100644 --- a/WebContent/html/webpages/navbar.jsp +++ b/WebContent/html/webpages/navbar.jsp @@ -22,6 +22,7 @@
  • Return Device
  • Device Listing
  • Shopping Cart
  • +
  • Logout
  • <% @@ -34,12 +35,15 @@ if(usercookies != null){ for(Cookie c : usercookies){ if(c.getName().equals("ssoNum")){//when (and if) we get to user cookie we want to reset it - navsso = c.getValue(); - c.setMaxAge(0);//delete current - newCookie = new Cookie("ssoNum",navsso);//make new one - newCookie.setMaxAge(30*60); - response.addCookie(newCookie); - break; + if(c.getValue().equals("") == false){ + navsso = c.getValue(); + c.setMaxAge(0);//delete current + newCookie = new Cookie("ssoNum",navsso);//make new one + newCookie.setMaxAge(30*60); + newCookie.setPath("/"); + response.addCookie(newCookie); + break; + } } } } diff --git a/WebContent/index.jsp b/WebContent/index.jsp index c9e4a6a..bec4e8a 100644 --- a/WebContent/index.jsp +++ b/WebContent/index.jsp @@ -122,15 +122,11 @@ Cookie newCookie; if(usercookies != null){ for(Cookie c : usercookies){ if(c.getName().equals("ssoNum")){//when (and if) we get to user cookie we want to reset it - navsso = c.getValue(); - c.setMaxAge(0);//delete current - newCookie = new Cookie("ssoNum",navsso); //make new one - newCookie.setMaxAge(30*60); - response.addCookie(newCookie); - break; + if(c.getValue().equals("") == false){ + response.sendRedirect("html/webpages/index.jsp"); + return; + } } } -} -if(navsso.equals("invalid") == false)//if we did get cookie, redirect to the homepage! - response.sendRedirect("html/webpages/index.jsp"); +} %> diff --git a/WebContent/userLogin.jsp b/WebContent/userLogin.jsp index 54f84ca..373502d 100644 --- a/WebContent/userLogin.jsp +++ b/WebContent/userLogin.jsp @@ -21,6 +21,7 @@ if (result.next()){ session.setAttribute("ssoNum", ssoNum); userCookie = new Cookie("ssoNum", Integer.toString(ssoNum)); userCookie.setMaxAge(30*60); + userCookie.setPath("/"); response.addCookie(userCookie); stmt.close(); connection.close(); @@ -28,7 +29,7 @@ if (result.next()){ } else { stmt.close(); connection.close(); - response.sendRedirect("index.jsp"); + response.sendRedirect("html/webpages/index.jsp"); } %> \ No newline at end of file From 87230c7b61e92a636272763a0b48987e52511042 Mon Sep 17 00:00:00 2001 From: Connor L Jackson Date: Thu, 13 Apr 2017 13:55:11 -0400 Subject: [PATCH 3/5] Switch branches --- WebContent/html/webpages/logoutPage.jsp | 36 ------------------------- 1 file changed, 36 deletions(-) delete mode 100644 WebContent/html/webpages/logoutPage.jsp diff --git a/WebContent/html/webpages/logoutPage.jsp b/WebContent/html/webpages/logoutPage.jsp deleted file mode 100644 index 1161ef7..0000000 --- a/WebContent/html/webpages/logoutPage.jsp +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - Synchrony Financial - - - - - - - - - - -
    -

    You Have Logged Out.

    - -
    - - \ No newline at end of file From 2a37d1e1b8eeb92a46ce3bcb84b366f786285ab1 Mon Sep 17 00:00:00 2001 From: Connor L Jackson Date: Fri, 14 Apr 2017 12:35:56 -0400 Subject: [PATCH 4/5] Admins are now forced to change their password upon first login --- WebContent/adminLogin.jsp | 19 ++++- WebContent/html/webpages/adminApprove.jsp | 16 +++-- .../html/webpages/adminDeviceSettings.jsp | 20 +++--- WebContent/html/webpages/adminpassword.jsp | 60 ++++++++++++++++ .../html/webpages/adminpasswordchange.jsp | 71 +++++++++++++++++++ .../html/webpages/adminpasswordtryagain.jsp | 61 ++++++++++++++++ WebContent/html/webpages/deviceRedirect.jsp | 4 +- WebContent/html/webpages/logout.jsp | 6 +- WebContent/html/webpages/navbar.jsp | 26 ++++--- src/database/AdminQueries.java | 36 ++++++++++ src/database/DeviceQueries.java | 10 +-- src/entities/Admin.java | 9 ++- src/entities/Device.java | 8 +-- 13 files changed, 302 insertions(+), 44 deletions(-) create mode 100644 WebContent/html/webpages/adminpassword.jsp create mode 100644 WebContent/html/webpages/adminpasswordchange.jsp create mode 100644 WebContent/html/webpages/adminpasswordtryagain.jsp create mode 100644 src/database/AdminQueries.java diff --git a/WebContent/adminLogin.jsp b/WebContent/adminLogin.jsp index 6341098..6f884ff 100644 --- a/WebContent/adminLogin.jsp +++ b/WebContent/adminLogin.jsp @@ -23,10 +23,23 @@ if (result.next()){ session.setAttribute("ssoNum", ssoNum); adminCookie = new Cookie("ssoNum", Integer.toString(ssoNum)); adminCookie.setMaxAge(30*60); + adminCookie.setPath("/"); response.addCookie(adminCookie); - stmt.close(); - connection.close(); - response.sendRedirect("html/webpages/admin.jsp"); + Cookie adminCookie2 = new Cookie("admin", Integer.toString(ssoNum)); + adminCookie2.setPath("/"); + response.addCookie(adminCookie2); + if(result.getInt("Password_Flag") == 1){ + stmt.close(); + connection.close(); + response.sendRedirect("html/webpages/admin.jsp"); + return; + } + else{ + stmt.close(); + connection.close(); + response.sendRedirect("html/webpages/adminpassword.jsp"); + return; + } } else { stmt.close(); connection.close(); diff --git a/WebContent/html/webpages/adminApprove.jsp b/WebContent/html/webpages/adminApprove.jsp index 6c999ef..bd55259 100644 --- a/WebContent/html/webpages/adminApprove.jsp +++ b/WebContent/html/webpages/adminApprove.jsp @@ -56,9 +56,6 @@ border-color: #3B3C43; border-radius: 5px; } - div.displayDevice{ - left: 0px; - } .form-control{ margin: auto; text-align: center; @@ -71,7 +68,6 @@ .table{ width: auto; background-color: #E9EAEB; - margin: 0 auto; } tbody{ @@ -89,6 +85,16 @@ <%@ include file="navbar.jsp"%> + +