-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This shouldn't interfere with anything anyone else is doing
- Loading branch information
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<%@ page import = "database.*,entities.User" %> | ||
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> | ||
<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">One thing</span> | ||
<span class="icon-bar"></span> | ||
<span class="icon-bar"></span> | ||
<span class="icon-bar"></span> | ||
</button> | ||
<a class="navbar-brand" href="../webpages/admin.jsp"> | ||
<img src="../imgs/synchrony-financial-logo-dlpx_1.png" style = "height: 100%; display: inline-block;"> | ||
| ||
<p style = "display: inline-block" id = "user"></p> | ||
</a> | ||
</div> | ||
<div id="navbar" class="navbar-collapse collapse" aria-expanded="false"> | ||
<ul class="nav navbar-nav navbar-right"> | ||
<li><a href="../webpages/">Home</a></li> | ||
<li><a href="requestPage.jsp">Request Device</a></li> | ||
<li><a href="returnPage.jsp">Return Device</a></li> | ||
<li><a href="listingPage.jsp">Device Listing</a></li> | ||
<li><a href="shoppingCart.jsp">Shopping Cart</a></li> | ||
</ul> | ||
</div> | ||
<% | ||
Cookie[] usercookies = request.getCookies(); | ||
String navsso = "invalid"; | ||
String navname = "error"; | ||
Cookie newCookie; | ||
//iterate cookies | ||
System.out.println("Cookies:\n----------\n"); | ||
for(Cookie c : usercookies){ | ||
System.out.println(c.getName()); | ||
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; | ||
} | ||
} | ||
System.out.println("\nnavsso = "+navsso+"\n"); | ||
if(navsso.equals("invalid"))//if we didn't get a cookie, redirect to the homepage to log in again! | ||
response.sendRedirect("../../index.jsp"); | ||
else{ | ||
User self = EmployeeQueries.getEmployeeByID(Integer.parseInt(navsso)); | ||
navname = self.getName(); | ||
} | ||
%> | ||
</div> | ||
<script> | ||
var name = '<%=navname%>'; | ||
document.getElementById('user').innerHTML = "Hi " + name + "!"; | ||
</script> |