Skip to content

Commit

Permalink
Merge pull request #122 from arc12012/bugs
Browse files Browse the repository at this point in the history
Bugs
  • Loading branch information
clj13001 committed Apr 14, 2017
2 parents c4ec0a7 + 924f70e commit 9323536
Show file tree
Hide file tree
Showing 18 changed files with 341 additions and 55 deletions.
19 changes: 16 additions & 3 deletions WebContent/adminLogin.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
7 changes: 4 additions & 3 deletions WebContent/html/webpages/admin.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ div.approveConfirm {
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<h4>Admin Options</h4>
<li class="option"><a href="../webpages/adminApprove.jsp">Approve Devices</a></li>
<li class="option"><a href="#">Manage Admins</a></li>
<li class="option"><a href="#">Manage Devices</a></li>
<li class="option"><a href="adminApprove.jsp">Approve Devices</a></li>
<!-- will add in when maegan is done <li class="option"><a href="#">Manage Admins</a></li> -->
<li class="option"><a href="adminDeviceSettings.jsp">Manage Devices</a></li>
<li class="option"><a href="adminLocation.jsp">Manage Locations</a></li>
</ul>
</div>
<div class="displayDevice">
Expand Down
19 changes: 15 additions & 4 deletions WebContent/html/webpages/adminApprove.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@
border-color: #3B3C43;
border-radius: 5px;
}
div.displayDevice{
left: 0px;
}
.form-control{
margin: auto;
text-align: center;
Expand All @@ -76,6 +73,10 @@
tbody{
text-align: left;
}
.btn{
margin-top: 15px;
}
</style>
</head>

Expand All @@ -84,6 +85,16 @@
<%@ include file="navbar.jsp"%>
</nav>

<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<h4>Admin Options</h4>
<li class="option"><a href="adminApprove.jsp">Approve Devices</a></li>
<!-- will add in when maegan is done <li class="option"><a href="#">Manage Admins</a></li> -->
<li class="option"><a href="adminDeviceSettings.jsp">Manage Devices</a></li>
<li class="option"><a href="adminLocation.jsp">Manage Locations</a></li>
</ul>
</div>

<!-- Modal for choosing ticket action. -->
<div id="Modal" class="modal">
<div class="modal-content">
Expand All @@ -94,7 +105,7 @@
<div class="modal-body">
<!-- Where new information is added. -->
<form ACTION = "ticketAdminRedirect.jsp" METHOD = "POST">
<table class="table table-bordered table-hover">
<table style = 'margin: 0 auto;' class="table table-bordered table-hover">
<thead>
<tr>
<th>Ticket ID</th>
Expand Down
20 changes: 11 additions & 9 deletions WebContent/html/webpages/adminDeviceSettings.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,14 @@ pageEncoding="ISO-8859-1"%>
<body>
<!-- Side bar -->
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<h4>Admin Options</h4>
<li class="option"><a href="../webpages/adminApprove.html">Approve Devices</a></li>
<li class="option"><a href="#">Manage Admins</a></li>
<li class="option"><a href="#">Manage Devices</a></li>
</ul>
</div>
<ul class="nav nav-sidebar">
<h4>Admin Options</h4>
<li class="option"><a href="adminApprove.jsp">Approve Devices</a></li>
<!-- will add in when maegan is done <li class="option"><a href="#">Manage Admins</a></li> -->
<li class="option"><a href="adminDeviceSettings.jsp">Manage Devices</a></li>
<li class="option"><a href="adminLocation.jsp">Manage Locations</a></li>
</ul>
</div>

<!-- Modal for adding new device. -->
<div id="addModal" class="modal">
Expand Down Expand Up @@ -129,7 +130,7 @@ pageEncoding="ISO-8859-1"%>
</div>
<div class = "form-group">
<label for="addNFC">NFC ID</label>
<input style = "width: 75px;" name = "NFC" class="form-control" type = "number" id="addNFC" placeholder="ID">
<input style = "width: 75px;" name = "NFC" class="form-control" id="addNFC" placeholder="ID">
</div><br>
<button type = "submit" name = "add" value = "Add" class="btn btn-primary">Add</button>
</form>
Expand Down Expand Up @@ -184,7 +185,7 @@ pageEncoding="ISO-8859-1"%>
</div>
<div class = "form-group">
<label for="modifyNFC">NFC ID</label>
<input style = "width: 75px;" name = "NFC" class="form-control" type = "number" id="modifyNFC" placeholder="ID">
<input style = "width: 75px;" name = "NFC" class="form-control" id="modifyNFC" placeholder="ID">
</div><br>
<button type = "submit" name = "modify" value = "Save Changes" class="btn btn-primary">Save Changes</button>
<button style = "display: inline-block;" type = "submit" name = "delete" value = "Delete Entry" class="btn btn-primary">Delete</button>
Expand Down Expand Up @@ -251,6 +252,7 @@ populateDevices(devices);
//adds event listeners to all table records
$("tr.entry").click(modifyModal);
//Exits modal when x is clicked.
$("#closeModifyForm").click(closeModifyModal);
//Open the add modal
Expand Down
15 changes: 8 additions & 7 deletions WebContent/html/webpages/adminLocation.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,14 @@
<body>
<!-- Sidebar -->
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<h4>Admin Options</h4>
<li class="option"><a href="../webpages/adminApprove.html">Approve Devices</a></li>
<li class="option"><a href="#">Manage Admins</a></li>
<li class="option"><a href="#">Manage Devices</a></li>
</ul>
</div>
<ul class="nav nav-sidebar">
<h4>Admin Options</h4>
<li class="option"><a href="adminApprove.jsp">Approve Devices</a></li>
<!-- will add in when maegan is done <li class="option"><a href="#">Manage Admins</a></li> -->
<li class="option"><a href="adminDeviceSettings.jsp">Manage Devices</a></li>
<li class="option"><a href="adminLocation.jsp">Manage Locations</a></li>
</ul>
</div>

<!-- Modal for adding new location. -->
<div id="addModal" class="modal">
Expand Down
60 changes: 60 additions & 0 deletions WebContent/html/webpages/adminpassword.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<%@ page import = "database.*,entities.User" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">

<title>Synchrony Financial</title>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel = "stylesheet" type = "text/css" href = "../css/stylesheet.css">
<link rel = "shortcut icon" href = "../imgs/synchrony-financial-logo-dlpx_1.ico">
<link rel="stylesheet" type="text/css" href="../javascript/iconselect.js-1.0/css/lib/control/iconselect.css" >
<script type="text/javascript" src="../javascript/iconselect.js-1.0/lib/control/iconselect.js"></script>
<script type="text/javascript" src="../javascript/iconselect.js-1.0/lib/iscroll.js"></script>

<style>
</style>

</head>

<body>
<!-- Header. -->
<nav class="navbar navbar-inverse navbar-fixed-top" id = "navbaruniversal">
<div class="container-fluid"><div class="navbar-header"><button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button><a class="navbar-brand" href="index.jsp"><img src="html/imgs/synchrony-financial-logo-dlpx_1.png" style = "height: 100%;"></a></div><div id="navbar" class="navbar-collapse collapse" aria-expanded="false"><ul class="nav navbar-nav navbar-right"><li><a href="index.jsp">Synchrony Device Request System</a></li></ul></div></div>
</nav>
<!-- All profile information -->
<div style = "margin-left: 30px;">
<!-- Where main user information is edited -->
<form action = "adminpasswordchange.jsp" class = "infobar">
<h2>Change Your Password</h2>
<h3>Since it is your first time logging in, you need to update your password.</h3>
<div class = "form-group">
<label for="old">Old Password</label>
<input style = "width: 200px;" name = "old" type = "password" class="form-control" id="old" required = "true">
</div>
<div class = "form-group">
<label for="new">New Password</label>
<input style = "width: 200px;" name = "new" type = "password" class="form-control" id="new" required = "true">
</div>
<div class = "form-group">
<label for="confirm">Confirm Password</label>
<input style = "width: 200px;" name = "confirm" type = "password" class="form-control" id="confirm" required = "true">
</div>
<div class = "form-group">
<label for="confirm">Pincode for Locker (4 digits long)</label>
<input style = "width: 200px;" name = "pincode" type = "password" class="form-control" id="pincode" required = "true">
</div>
<button name = "submit" type="submit" class="btn btn-primary" id = "submit">Apply Changes</button>
</form>
</div>
</body>

</html>
71 changes: 71 additions & 0 deletions WebContent/html/webpages/adminpasswordchange.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<%@ page import = "database.*,entities.Device" %>
<%@ page import = "java.sql.*" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">

<title>Synchrony Financial</title>

<link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel = "stylesheet" type = "text/css" href = "../css/stylesheet.css">
<link rel = "shortcut icon" href = "../imgs/synchrony-financial-logo-dlpx_1.ico">
<nav class="navbar navbar-inverse navbar-fixed-top" id = "navbaruniversal">
<%@ include file="navbar.jsp"%>
</nav>
</head>
<body>
<h2>Redirect Page</h2>
<p>You shouldn't be seeing this page :)</p>

<%
//add form was submitted
if(request.getParameter("submit") != null){
String old = request.getParameter("old");
String newpass = request.getParameter("new");
String confirm = request.getParameter("confirm");
String pincode = request.getParameter("pincode");
String database = "jdbc:mysql://us-cdbr-iron-east-04.cleardb.net/ad_15a989204c2ff8a?user=b372dfe7409692&password=74f6e317";
String user = "b372dfe7409692";
String password = "74f6e317";
System.getenv("VCAP_SERVICES");
Class.forName("com.mysql.jdbc.Driver");
Connection connection = DriverManager.getConnection(database, user, password);
Statement stmt = connection.createStatement();
ResultSet result;
result = stmt.executeQuery("select * FROM admin where Admin_ID='" + navsso + "' AND Password='" + old + "'");
if(result.next()){//if old password is accurate
if (!old.equals(newpass) && newpass.equals(confirm) && pincode.length() == 4 && AdminQueries.pincodeInt(pincode)){//if the password is new AND both news ones are equal AND pincode is 4 digits AND pincode is a number
stmt.executeUpdate("UPDATE admin SET Password = \"" + newpass + "\", Password_Flag = 1, Pincode = " + pincode + " WHERE Admin_ID = " + navsso);
stmt.close();
connection.close();
response.sendRedirect("admin.jsp");
return;
}
else{
stmt.close();
connection.close();
response.sendRedirect("adminpasswordtryagain.jsp");
return;
}
}
else{
stmt.close();
connection.close();
response.sendRedirect("adminpasswordtryagain.jsp");
return;
}
}
%>
</body>
</html>
61 changes: 61 additions & 0 deletions WebContent/html/webpages/adminpasswordtryagain.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<%@ page import = "database.*,entities.User" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">

<title>Synchrony Financial</title>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel = "stylesheet" type = "text/css" href = "../css/stylesheet.css">
<link rel = "shortcut icon" href = "../imgs/synchrony-financial-logo-dlpx_1.ico">
<link rel="stylesheet" type="text/css" href="../javascript/iconselect.js-1.0/css/lib/control/iconselect.css" >
<script type="text/javascript" src="../javascript/iconselect.js-1.0/lib/control/iconselect.js"></script>
<script type="text/javascript" src="../javascript/iconselect.js-1.0/lib/iscroll.js"></script>

<style>
</style>

</head>

<body>
<!-- Header. -->
<nav class="navbar navbar-inverse navbar-fixed-top" id = "navbaruniversal">
<div class="container-fluid"><div class="navbar-header"><button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button><a class="navbar-brand" href="index.jsp"><img src="html/imgs/synchrony-financial-logo-dlpx_1.png" style = "height: 100%;"></a></div><div id="navbar" class="navbar-collapse collapse" aria-expanded="false"><ul class="nav navbar-nav navbar-right"><li><a href="index.jsp">Synchrony Device Request System</a></li></ul></div></div>
</nav>
<!-- All profile information -->
<div style = "margin-left: 30px;">
<!-- Where main user information is edited -->
<form action = "adminpasswordchange.jsp" class = "infobar">
<h2>Change Your Password</h2>
<h3>Since it is your first time logging in, you need to update your password.</h3>
<h4>Please make sure your old password is correct, your new ones are new and matching, and your pincode is 4 digits long.</h4>
<div class = "form-group">
<label for="old">Old Password</label>
<input style = "width: 200px;" name = "old" type = "password" class="form-control" id="old" required = "true">
</div>
<div class = "form-group">
<label for="new">New Password</label>
<input style = "width: 200px;" name = "new" type = "password" class="form-control" id="new" required = "true">
</div>
<div class = "form-group">
<label for="confirm">Confirm Password</label>
<input style = "width: 200px;" name = "confirm" type = "password" class="form-control" id="confirm" required = "true">
</div>
<div class = "form-group">
<label for="confirm">Pincode for Locker (4 digits long)</label>
<input style = "width: 200px;" name = "pincode" type = "password" class="form-control" id="pincode" required = "true">
</div>
<button name = "submit" type="submit" class="btn btn-primary" id = "submit">Apply Changes</button>
</form>
</div>
</body>

</html>
4 changes: 1 addition & 3 deletions WebContent/html/webpages/deviceRedirect.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ String manufacturer = request.getParameter("manu").replace("\"","\\\"");
String hardware = request.getParameter("hardware").replace("\"","\\\"");
String model = request.getParameter("model").replace("\"","\\\"");
String serial = request.getParameter("serial");
int nfc = Integer.parseInt(request.getParameter("NFC"));
String nfc = request.getParameter("NFC");
//add form was submitted
if(request.getParameter("add") != null){
Device device = new Device(name,1,description,hardware,model,manufacturer,status,mac,serial,nfc);
Expand Down Expand Up @@ -65,7 +65,5 @@ if(request.getParameter("delete") != null){
<script>
window.location.replace("adminDeviceSettings.jsp");
</script>
<!-- Navbar generation. -->
<script src = "../javascript/navbar.js"></script>
</body>
</html>
22 changes: 22 additions & 0 deletions WebContent/html/webpages/logout.jsp
Original file line number Diff line number Diff line change
@@ -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") || c.getName().equals("admin")){//when (and if) we get to user cookie we want to reset it
c.setMaxAge(0);//delete current
String cookiename = c.getName();
Cookie newCookie = new Cookie(cookiename,"");//make new one
newCookie.setMaxAge(0);
newCookie.setPath("/");
response.addCookie(newCookie);
}
}
}
response.sendRedirect("index.jsp");
return;
%>
Loading

0 comments on commit 9323536

Please sign in to comment.