-
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.
Merge remote-tracking branch 'refs/remotes/origin/master' into bugs
- Loading branch information
Showing
13 changed files
with
155 additions
and
4 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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
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> |
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
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,67 @@ | ||
package utilities; | ||
|
||
import java.awt.HeadlessException; | ||
import java.util.*; | ||
import javax.mail.*; | ||
import javax.mail.internet.*; | ||
import javax.activation.*; | ||
|
||
|
||
public class Mail { | ||
|
||
public Mail() { | ||
} | ||
public void email() { | ||
String from = "arclaxton@gmail.com"; | ||
String password = "*****"; | ||
String to = "arclaxton@gmail.com"; | ||
String subject = "test"; | ||
String msg = "this is a test"; | ||
Properties properties = System.getProperties(); | ||
properties = setProp(from, to); | ||
Session session = Session.getInstance(properties, new Authenticator() { | ||
protected PasswordAuthentication getPasswordAuthentication(){ | ||
return new PasswordAuthentication(from, password); | ||
} | ||
}); | ||
|
||
try { | ||
Address address = new InternetAddress(to); | ||
MimeMessage message = new MimeMessage(session); | ||
message.setFrom(address); | ||
message.addRecipient(Message.RecipientType.TO, address); | ||
message.setSubject(subject); | ||
message.setText(msg); | ||
message.saveChanges(); | ||
Transport.send(message); | ||
System.out.println("Sent message successfully...."); | ||
|
||
} catch (Exception mex) { | ||
mex.printStackTrace(); | ||
} | ||
|
||
} | ||
|
||
private Properties setProp(String email, String targetEmail) { | ||
Properties props = null; | ||
try { | ||
props = System.getProperties(); | ||
props.setProperty("mail.transport.protocol", "smtp"); | ||
if (email.contains(",") || targetEmail.contains(",")) { | ||
System.out.println("Please send one email to one person at a time..."); | ||
} else if (email.contains("@gmail.com")) { | ||
props.put("mail.smtp.host", "smtp.gmail.com"); | ||
props.put("mail.smtp.socketFactory.port", "465"); | ||
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); | ||
props.put("mail.smtp.auth", "true"); | ||
props.put("mail.smtp.port", "465"); | ||
} else { | ||
System.out.println("Your Email Address is invalid\n or host not supported!"); | ||
} | ||
|
||
} catch (HeadlessException exp) { | ||
System.out.println(exp); | ||
} | ||
return props; | ||
} | ||
} |