From 2a37d1e1b8eeb92a46ce3bcb84b366f786285ab1 Mon Sep 17 00:00:00 2001 From: Connor L Jackson Date: Fri, 14 Apr 2017 12:35:56 -0400 Subject: [PATCH] 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"%> + +