From 2f8dd7377d4b0b02743e018fd0ac5fb5eea3fddd Mon Sep 17 00:00:00 2001 From: Connor L Jackson Date: Sat, 22 Apr 2017 14:14:18 -0400 Subject: [PATCH 1/2] Password Reset Still needs a bit of extra work --- WebContent/adminLogin.jsp | 84 +++----------------- WebContent/index.jsp | 4 +- WebContent/passwordreset.jsp | 149 +++++++++++++++++++++++++++++++++++ 3 files changed, 163 insertions(+), 74 deletions(-) create mode 100644 WebContent/passwordreset.jsp diff --git a/WebContent/adminLogin.jsp b/WebContent/adminLogin.jsp index df36b10..9c3445f 100644 --- a/WebContent/adminLogin.jsp +++ b/WebContent/adminLogin.jsp @@ -28,8 +28,18 @@ <% @@ -140,69 +150,6 @@ if(request.getParameter("login") != null){ /* If the user wants to reset their password, we will keep them on this page. */ -//if(request.getParameter("reset") != null){ - //int ssoNum = Integer.parseInt(request.getParameter("username")); - - /* - Generate new password randomly - */ - //String chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - //StringBuilder random = new StringBuilder(); - //Random rnd = new Random(); - //String is 16 characters long - //while(random.length() < 16){ - //int index = (int)(rnd.nextFloat()*chars.length()); - //} - //String newpass = random.toString(); - //String hashpass = null; - - /* - Hash new password. - */ - //try { - //MessageDigest md1 = MessageDigest.getInstance("MD5"); - //md1.update(newpass.getBytes()); - //byte[] bytes = md1.digest(); - //StringBuilder sb = new StringBuilder(); - //for(int i = 0; i \ No newline at end of file diff --git a/WebContent/index.jsp b/WebContent/index.jsp index f44d00c..16d5526 100644 --- a/WebContent/index.jsp +++ b/WebContent/index.jsp @@ -95,7 +95,7 @@ pageEncoding="ISO-8859-1"%> @@ -103,7 +103,7 @@ pageEncoding="ISO-8859-1"%>

Admin Login

-
+
diff --git a/WebContent/passwordreset.jsp b/WebContent/passwordreset.jsp new file mode 100644 index 0000000..83a0d39 --- /dev/null +++ b/WebContent/passwordreset.jsp @@ -0,0 +1,149 @@ +<%@ page import = "database.*" %> +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> +<%@ page import = "java.sql.*" %> +<%@ page import = "java.security.MessageDigest" %> +<%@ page import = "java.security.NoSuchAlgorithmException" %> +<%@ page import = "java.util.Random" %> + + + + + + + + + + + Innovation Hub + + + + + + + + + + + +<% +int success = 0; +/* + If the user wants to reset their password, we will keep them on this page. +*/ +//if(request.getParameter("reset") != null){ + //int ssoNum = Integer.parseInt(request.getParameter("username")); + //String email = request.getParameter("email"); + + /* + Generate new password randomly + */ + //String chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; + //StringBuilder random = new StringBuilder(); + //Random rnd = new Random(); + //String is 16 characters long + //while(random.length() < 16){ + //int index = (int)(rnd.nextFloat()*chars.length()); + //random.append(chars.charAt(index)); + //} + //String newpass = random.toString(); + //String hashpass = null; + + /* + Hash new password. + */ + //try { + //MessageDigest md1 = MessageDigest.getInstance("MD5"); + //md1.update(newpass.getBytes()); + //byte[] bytes = md1.digest(); + //StringBuilder sb = new StringBuilder(); + //for(int i = 0; i + + \ No newline at end of file From d9c38d7fa2c7789757277dc5d7d0cdab193a8eec Mon Sep 17 00:00:00 2001 From: Connor L Jackson Date: Sat, 22 Apr 2017 14:24:23 -0400 Subject: [PATCH 2/2] Push --- WebContent/passwordreset.jsp | 142 +++++++++++++++++------------------ 1 file changed, 70 insertions(+), 72 deletions(-) diff --git a/WebContent/passwordreset.jsp b/WebContent/passwordreset.jsp index 83a0d39..f8f0f78 100644 --- a/WebContent/passwordreset.jsp +++ b/WebContent/passwordreset.jsp @@ -1,4 +1,4 @@ -<%@ page import = "database.*" %> +<%@ page import = "database.*,entities.User,utilities.Mail" %> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ page import = "java.sql.*" %> <%@ page import = "java.security.MessageDigest" %> @@ -33,100 +33,98 @@ <% -int success = 0; +int success=0; /* If the user wants to reset their password, we will keep them on this page. */ -//if(request.getParameter("reset") != null){ - //int ssoNum = Integer.parseInt(request.getParameter("username")); - //String email = request.getParameter("email"); +if(request.getParameter("reset") != null){ + int ssoNum = Integer.parseInt(request.getParameter("username")); + String email = request.getParameter("email"); /* Generate new password randomly */ - //String chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; - //StringBuilder random = new StringBuilder(); - //Random rnd = new Random(); + String chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; + StringBuilder random = new StringBuilder(); + Random rnd = new Random(); //String is 16 characters long - //while(random.length() < 16){ - //int index = (int)(rnd.nextFloat()*chars.length()); - //random.append(chars.charAt(index)); - //} - //String newpass = random.toString(); - //String hashpass = null; + while(random.length() < 16){ + int index = (int)(rnd.nextFloat()*chars.length()); + random.append(chars.charAt(index)); + } + String newpass = random.toString(); + String hashpass = null; /* Hash new password. */ - //try { - //MessageDigest md1 = MessageDigest.getInstance("MD5"); - //md1.update(newpass.getBytes()); - //byte[] bytes = md1.digest(); - //StringBuilder sb = new StringBuilder(); - //for(int i = 0; i